Hello guys, on Perspective I have a popup view and on startup I get data from SQL through a NamedQuery (SELECT *), and then populate input fields and text fields with data retrieved.
The problem is that if a field in SQL is a varchar and its value is NULL (not populated) Perspective shows "null" in the text field.
Is there a way to prevent this and set the text field = "" or have I to check in my script for every varchar to not be "null"?
This is the code to populate fields on the popup view on startup:
if (self.params.IDOrder != "") :
dataOrder = system.db.runNamedQuery('Order/SelectByID', {'IDOrder': self.params.IDOrder})
self.params.IDCoil = dataOrder[0]["IDCoil"]
dataContainer1 = self.getChild("root").getChild("Flex container").getChild("Data container1")
dataContainer1.getChild("FlexContainer_0").getChild("CutLength").props.value = dataOrder[0]["CutLength"]
dataContainer1.getChild("FlexContainer_1").getChild("TrimWidth").props.value = dataOrder[0]["TrimWidth"]
dataContainer1.getChild("FlexContainer_2").getChild("TargetSheets").props.value = dataOrder[0]["TargetSheets"]
dataContainer1.getChild("FlexContainer_4").getChild("TargetPackages").props.value = dataOrder[0]["TargetPackages"]
dataContainer1.getChild("FlexContainer_8").getChild("StrapType").props.value = dataOrder[0]["StrapType"]
dataContainer1.getChild("FlexContainer_9").getChild("BeamType").props.value = dataOrder[0]["BeamType"]
dataContainer1.getChild("FlexContainer_11").getChild("CornerType").props.value = dataOrder[0]["CornerType"]
dataContainer1.getChild("FlexContainer_12").getChild("StrapNumber").props.value = dataOrder[0]["StrapNumber"]
dataContainer2 = self.getChild("root").getChild("Flex container").getChild("Data container2")
dataContainer2.getChild("FlexContainer_6").getChild("FlexContainer").getChild("LengthToleranceMin").props.value = dataOrder[0]["NegativeLengthTolerance"]
dataContainer2.getChild("FlexContainer_6").getChild("FlexContainer").getChild("LengthToleranceMax").props.value = dataOrder[0]["PositiveLengthTolerance"]
dataContainer2.getChild("FlexContainer_7").getChild("FlexContainer").getChild("WidthToleranceMin").props.value = dataOrder[0]["NegativeWidthTolerance"]
dataContainer2.getChild("FlexContainer_7").getChild("FlexContainer").getChild("WidthToleranceMax").props.value = dataOrder[0]["PositiveWidthTolerance"]
dataContainer2.getChild("FlexContainer_10").getChild("FlexContainer").getChild("ThicknessToleranceMin").props.value = dataOrder[0]["NegativeThicknessTolerance"]
dataContainer2.getChild("FlexContainer_10").getChild("FlexContainer").getChild("ThicknessToleranceMax").props.value = dataOrder[0]["PositiveThicknessTolerance"]
dataContainer2.getChild("FlexContainer_4").getChild("Customer").props.text = dataOrder[0]["Customer"]
dataContainer2.getChild("FlexContainer_5").getChild("Batch").props.text = dataOrder[0]["Batch"]
dataContainer2.getChild("FlexContainer").getChild("Info1").props.text = dataOrder[0]["Info1"]
dataContainer2.getChild("FlexContainer_0").getChild("Info2").props.text = dataOrder[0]["Info2"]
dataContainer2.getChild("FlexContainer_1").getChild("Info3").props.text = dataOrder[0]["Info3"]
dataContainer2.getChild("FlexContainer_2").getChild("Info4").props.text = dataOrder[0]["Info4"]
dataContainer2.getChild("FlexContainer_3").getChild("Info5").props.text = dataOrder[0]["Info5"]
![Screenshot 2024-01-18 101208](https://global.discourse-cdn.com/inductiveautomation/original/3X/3/1/310ce75f95443a49caa7368406552c8b7f267e95.png)