Truncating and Appending data not working

I’m trying to create a Unique Order Reference Number but it’s not working suddenly. Can anyone shed any light on this please?

It’s supposed to create this by amalgamating;
a) the first four characters of a User’s Username
b) the last six digits of the current time formatted as Unix Time Stamp
c) a random string of 3 letters.

Here’s a screenshot of what I’ve got so far to achieve the above.

But it’s not including the first four characters of the User’s Username. Can anyone tell me why?
It was working until I changed the formula to append the last 6 characters of the Unix Time Stamp which I did because the whole time stamp was too long.

If anyone can help me I’d be truly grateful.
All the best

Hey Joe,

It seems to work fine, I recreated the dynamic data in a text field:

Dynamic data:

Result:

image

One thing I noticed is that in the screenshot you are using current user and in the text below the screenshot you mention “User’s Username”. If you want to display data from other users you might need to change the privacy rules for the User datatype to something that makes sense for your app:

If you are showing this information in a repeating group, the dynamic data will be something like this:

image

Thank you so much for this. I was at a loss. I’m wondering if it’s something on my setup here and I’ve noticed my Mac is beginning to run slower as I’ve been pushing it a bit today and my brain is fairly fried at this point on a Friday. I’ll reboot it, have a coffee and come back to it. I really appreciate your input here though.
I think I’m OK for Privacy Rules although you’ve taught me something else there so I’m really grateful for that. I’m trying to incorporate the Current User’s Username into the OrderNo so that should be OK. I’ll report back when Mac and I have both had a small break!
Thanks again.

1 Like

Hi Again
I’ve been doing a lot of experimenting with this and discovered that I can generate the UniqueReference I want in a Text doing exactly the same as you but I can’t create this in a WorkFlow which sets a Custom State to that value so I can use it elsewhere because that requires me to use an :Append which, if I do use, doesn’t offer me the option of appending Date/Time. In fact, using :Append in a workflow to set a Custom State doesn’t work at all. CAn you think of a way around this?

Hey Joe, that is weird because it actually does work when I try. In the example below a workflow is triggered to calculate that formula and place it in a custom state, the value of the custom state is also displayed in a text.

Note: Because “truncated from end” reacts differently in workflow vs. page (maybe a bug) I use an extra custom state to get the last 6 numbers from the unix timestamp.

The example:

  1. Two custom states on the page:

image

  1. The text is configured to show the value of the custom state:

  1. The workflow:

  1. When the button “Start Workflow” is clicked the result is shown in the text:

  1. And when you use the inspect-function, you can see the value in the custom state:

Maybe try it again, if it does not work let me know, I can always have a look.