Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi Community,
I need to control some attributes in the flow, but I have controlled them, except for a few cases.
The first error is if EN_LANG attributes in WTPart are empty, it gives an error for null value.
The second error is that SURFACE_M2 attributes are defined with com.ptc.core.meta.common.FloatingPoint type, but SURFACE_M2 attributes can receive values automatically from creo, and when this value is an integer (for example 1), it gives an error in getting the value.
I tried to get the values of these attributes in the code below
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(part,null,java.util.Locale.getDefault(),new com.ptc.core.meta.common .UpdateOperationIdentifier());
obj.load("EN_LANG","SURFACE_M2"); EN_LANG=(java.lang.String) obj.get("EN_LANG"); SURFACE_M2=(com.ptc.core.meta.common.FloatingPoint) obj.get("SURFACE_M2");
Solved! Go to Solution.
Hi @smcvr
It is common that empty attribute is null, so you need to catch the null exception and solve it in that case. For example result = "";
PetrH
Hi @smcvr
It is common that empty attribute is null, so you need to catch the null exception and solve it in that case. For example result = "";
PetrH
Hi @HelesicPetr ,
In the rest of the code, I was checking the number of characters of the value. When the value was null, he had problems checking that part. I fixed the error now,
thank you 🙂