Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
I can get a string attribute from the Change Activity to the workflow. How do I convert a long attribute to an int attribute? Code for string is below where attribute is the attribute in the change activity and att1 is the attribute in the workflow.
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null,java.util.Locale.US,null);
obj.load("attribute");
att1 = (String) obj.get("attribute")
What error is shown in a log if the Long parameter is not converted to a int?
does it really the java.lang.Long or is it different type as float, double and so on.
PetrH
I've checked some my workflows and I always use the .toString() operation.
String tested_km = obj.get("tested_km").toString();
After I get value I work with string even it is number, double, int, or whatever.
It helps to avoid typeo errors in WF but also depends on the attribute type. Not all are eligible to use .getString().
PetrH
I would suggest to get the long value and then get the integer:
com.ptc.core.lwc.server.PersistableAdapter obj = new com.ptc.core.lwc.server.PersistableAdapter(primaryBusinessObject,null,java.util.Locale.US,null);
obj.load("attribute");
long att1 = (long) obj.get("attribute")
int intValue = att1.intValue();
Hi BrianToussaint,
I wanted to follow up with you on your post to see if your question has been answered.
If so, please designate the appropriate post as the Accepted Solution for the benefit of other members who may have the same question.
If not, please post your current status in the public thread so that we can continue to support.
Thanks,
Iuliana