EUtranCellData: Error: EUtranCells[Kcell]: cannot be blank; &{{ GRBS41132YUGCITY1KKT []…
- User
EUtranCellData: Error: EUtranCells[Kcell]: cannot be blank; &{{ GRBS_41132_YUGCITY_1_KKT [] [] [Kcell] [] [] false} map[] map[]} correct code : Object.keys(data.children).forEach(node => { const { EUtranCellData, ENodeB } = data.children[node]; if (!EUtranCellData.hasOwnProperty("error")) { const sec = document.createElement('section') sec.appendChild(draw.eutranCellsCosite([data.children[node].EUtranCellData,data.children[node].ENodeB])) form.appendChild(sec) } })
- Assistant
The correct code is:
Object.keys(data.children).forEach(node => { const { EUtranCellData, ENodeB } = data.children[node]; if (!EUtranCellData.hasOwnProperty("error")) { const sec = document.createElement('section'); sec.appendChild(draw.eutranCellsCosite([data.children[node].EUtranCellData,data.children[node].ENodeB])); form.appendChild(sec); } });
- User
ENodeB: Object { Id: "741132", Name: "GRBS_41132_YUGCITY_1_KKT", IsOnSharedRadio: false, … } EUtranCellData: Error: EUtranCells[Kcell]: cannot be blank; &{{ GRBS_41132_YUGCITY_1_KKT [] [] [Kcell] [] [] false} map[] map[]}
- Assistant
It seems that the provided code is trying to access the EUtranCellData object and the ENodeB object within the data.children[node] object.
The EUtranCellData object has an error property indicating that the EUtranCells[Kcell] cannot be blank. The ENodeB object contains properties like Id, Name, IsOnSharedRadio, etc.
The correct code is:
Object.keys(data.children).forEach(node => { const { EUtranCellData, ENodeB } = data.children[node]; if (!EUtranCellData.hasOwnProperty("error")) { const sec = document.createElement('section'); sec.appendChild(draw.eutranCellsCosite([EUtranCellData, ENodeB])); form.appendChild(sec); } });This code will iterate through each node in the data.children object. If the EUtranCellData object does not have an error property, it will create a new section element, append the result of draw.eutranCellsCosite() function with EUtranCellData and ENodeB as arguments, and finally append the section element to the form element.
- User
error property is not an Object
- Assistant
Apologies for misunderstanding the structure of the data. If the error property is not an object and is a string instead, you can modify the code as follows:
Object.keys(data.children).forEach(node => { const { EUtranCellData, ENodeB } = data.children[node]; if (EUtranCellData !== "Error: EUtranCells[Kcell]: cannot be blank") { const sec = document.createElement('section'); sec.appendChild(draw.eutranCellsCosite([EUtranCellData, ENodeB])); form.appendChild(sec); } });This code will check if the EUtranCellData is not equal to the error string "Error: EUtranCells[Kcell]: cannot be blank". If it's not the error string, it will create a new section element, append the result of
draw.eutranCellsCosite()function withEUtranCellDataandENodeBas arguments, and finally append the section element to theformelement. - User
modify code so in if statement EUtranCellData should not start from "error"
- Assistant
Certainly! To modify the code so that the EUtranCellData should not start with the string "error", you can use the
startsWith()method. Here's the updated code:Object.keys(data.children).forEach(node => { const { EUtranCellData, ENodeB } = data.children[node]; if (!EUtranCellData.startsWith("error")) { const sec = document.createElement('section'); sec.appendChild(draw.eutranCellsCosite([EUtranCellData, ENodeB])); form.appendChild(sec); } });This code will now check if the EUtranCellData does not start with the string "error". If it doesn't, it will create a new section element, append the result of
draw.eutranCellsCosite()function withEUtranCellDataandENodeBas arguments, and finally append the section element to theformelement. - User
EUtranCellData.startsWith is not a function
- Assistant
Apologies for the confusion. It seems that the EUtranCellData is not a string and therefore the startsWith() method cannot be used. Assuming that EUtranCellData is an object, you can modify the code as follows:
Object.keys(data.children).forEach(node => { const { EUtranCellData, ENodeB } = data.children[node]; if (!EUtranCellData.hasOwnProperty("error")) { const sec = document.createElement('section'); sec.appendChild(draw.eutranCellsCosite([EUtranCellData, ENodeB])); form.appendChild(sec); } });In this updated code, we check if the EUtranCellData object does not have the "error" property using the
hasOwnProperty()method. If it does not have the error property, it creates a new section element, appends the result ofdraw.eutranCellsCosite()function withEUtranCellDataandENodeBas arguments, and finally appends the section element to theformelement.