cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Sdcript Functions does NOT return the complete long value ?

seanccc
17-Peridot

Sdcript Functions does NOT return the complete long value ?

Hi , 

I created a  custom script function called GenerateUid.  This function generate a unique id(Long type) for every call using the snowflake id algorithm.   

 

It works in the backend of the extension, I can see the unique id is generated correctly in debug.  However,   the last two digits  of the value returned to ThingWorx is always "00".  For example,  the generated id is 569467214119305221, but the value in ThingWorx's service result is 

 

In debug you can see the uid is 569467214119305221.
image.png

 

but in ThingWorx it's 569467214119305200

image.png

===========Version ==========

ThingWorx 8.5.5

Database: Postgresql 10.x

OS: REHL 7.6

 

======================================Update========================

I changed the return type from LONG to STRING and everything works.  so there must be something wrong for LONG ? 

 

Regards,

Sean

1 ACCEPTED SOLUTION

Accepted Solutions
CharlesJi
14-Alexandrite
(To:seanccc)

The workaround is to use STRING instead of LONG provided in this ticket.

And the LONG to STRING conversion issue has been fixed since ThingWorx 9.1.0.

https://www.ptc.com/en/support/article/CS341174

View solution in original post

3 REPLIES 3
PaiChung
22-Sapphire I
(To:seanccc)

Looks like a bug, recommend you start a ticket.

seanccc
17-Peridot
(To:PaiChung)

@PaiChung ,

I just openned a ticket for this issue: 

 

https://support.ptc.com/apps/case_logger_viewer/auth/ssl/case=15506658?from=logger

 

Regards,

Sean

CharlesJi
14-Alexandrite
(To:seanccc)

The workaround is to use STRING instead of LONG provided in this ticket.

And the LONG to STRING conversion issue has been fixed since ThingWorx 9.1.0.

https://www.ptc.com/en/support/article/CS341174

Top Tags