I keep getting this error with a number field on the template
The value for number field Invoice_Amount should be numbers.
But I am using the workflow numeric format code "d", what format does it expect for a number?
I keep getting this error with a number field on the template
The value for number field Invoice_Amount should be numbers.
But I am using the workflow numeric format code "d", what format does it expect for a number?
Capture Profile tokens are all type "text", they're not numbers.
Your formatting is wrong for numbers, it would be "d" followed by an integer that specifies the minimum number of digits you want. So "d5" would convert "12" into "00012".
The token for calling the rule is type text, but the template field is a type of number, so as long as the text passed to the API rule is a valid number then it works.
I tried using any number formatting I could find in workflow and it would not take it as a number as long as it contained commas, which makes no sense to me. I formatted it as a number, the output has commas even when you format it as a number in workflow.
To work around it, I had to create a custom rule to remove commas from the string
JOIN("",SPLIT(%(Input),%(CharacterToReplace)))
But this seems odd to me, I would expect the built in functions for converting to a number would work out of the box.
Rules do not yet have all the bells and whistles of Workflow when it comes to figuring out if whatever data you throw at it could fit into the data type you stated.
Formatting will not convert text to numbers, it will only modify how a number displays. For rules, you would have to make sure the number is just digits and a period as a decimal separator. Another rule shouldn't be necessary, Assign Tokens with regular expression would work too.
Can a regular expression replace? I thought it could only find and return what it finds.
I actually checked stack overflow for a regex that could replace commas and didn't come up with any luck before I created the replace rule.
I was thinking formatting was the best way to convert the type of a variable in workflow. Like strings to proper numbers and dates (or nothing if they can't be). Preventing trying to insert any wrong data type into the wrong field type.
Not sure why replacing commas is needed.
A pattern matching activity using ([0-9\.]+) set to return all matches without spaces would "remove" commas from a string because it would just look for digits and periods.
Hi,
If the goal is to assign a field value through calling Laserfiche AssignFieldValues API, please note that these are the tokens supported by the API: https://doc.laserfiche.com/laserfiche.documentation/en-us/Content/Tokens.htm
So, the way the token is used below, is not supported:
"Invoice_Amount": { "values": [ { "value": "%(Name: InvoiceAmount; Type: Text)", "position": 1 } ] }
We never pass a token directly from Workflow to the API, we can only pass a JSON body.
But by formatting the token correctly in workflow before it gets inserted into the JSON body we can successfully use the API.
The confusion here was that I was formatting the token from an Invoice Amount token generated by invoice capture to be a decimal number before creating the JSON. The result was something like this 1,200.15
The API was stating this was not a number, which confused me. Eventually I narrowed it down to not wanting any commas, which has to be done specifically as there is no numeric formatting option for this.