I have created a simple “Samples” entity with a string Custom Field named Field
I can add a new entity with “123-456” as value for the Custom Field by clicking on “Add Entity” on the Entities window
If I try to create an entity using rules, actions or scritps the “123-456” gets transformed into a date value
So, if I click “Add Entity” at Entities and I enter a value for the Custom Field, this value goes directly into the database. While setting this value from actions, rules, and scripts seems to undergo a different process
I have played with the attributes of the Custom Field (Mask Type, Editting Format, Default Value, etc.) but they do not seem to be related to the problem
I have SambaPOS 5.3.0
Odd, doing some work on scripts at the minute which uses the api entity helpers for entity data and havnt noticed this…
Run a few tests, does say just 123 do it?
If you set the string in the script rather than input var does it do it.
Yes, setting the string in the script rather than passing it as parameter also leads to a value converted to date
If I set a value like “abc” then there is no problem. The only problem is with strings that have numbers and the “-” character which SambaPOS may be converting to dates automatically
Try to force the data type:
var field_value = String(field_value);
var newFieldValue = String(field_value);
For both cases the string still gets converted to a date:
Hmm. I was thinking maybe it was converting to date based on the the sum of the numbers but nothing matches up to the Julian Date for what gets saved.
Okay, so the backend is calculating based on the Julian date.
111-111 turns into 5/3/2020
Today’s Julian Date is 176. The Julian Date for 5/3 is 65. 176-65 = 111
It seems only the int in front of the minus sign is used.
@Memo WTF, where did that come from.
Guess we know what your hobby is lol
Maybe I’m just ignorant, had to Google it lol
What type is the field set to?
What type is the field
From his original post, it’s a String
Date finds its way as the final value no matter what Field Type is specified. Something, somewhere is subtracting days from the current date and returning that result.
Perhaps set it to number
I have tried and the result is the same:
This issue persists and only seems to occur when using the API and does not occur when manually created within the desktop application.
this is caused by
Could someone please look into this? Please and thank you.