Page 1 of 1
Length of variable
Posted: Tue Sep 19, 2023 2:16 pm
by JimmyHartington
I can not seem to find out how to get the length (number of characters) of a variable.
Is there a built in way in Switch to do this?
Or do I have to use scripting?
Re: Length of variable
Posted: Wed Sep 20, 2023 3:51 pm
by freddyp
I am interested in hearing what the use case is.
If the number of possibilities is limited you could create a condition with variables where you match the variable with .{3} for three characters etc. On the outgoing connection folder you can then set private data with the number.
Re: Length of variable
Posted: Thu Sep 21, 2023 9:21 am
by JimmyHartington
I have an action list, which places a string (variable from Switch) onto the first page.
If the number of characters of the string is larger than 90 I would like to set the font size to another value.
And since Loic Agnon showed the conditional variables in Pitstop I would like to use them to set the font size dynamically.
But since thinking about it I have another way in this case to achieve what I want.
After I add the text I select all text with which overlaps the media box and scales it down to a specific width in mm.
Re: Length of variable
Posted: Thu Sep 21, 2023 11:50 am
by magnussandstrom
I have done a similar thing, similiar to Freddys idea. Maybe this helps:
- flow_90.png (28.76 KiB) Viewed 8083 times
- regex_90.png (14.9 KiB) Viewed 8083 times
Re: Length of variable
Posted: Thu Sep 21, 2023 2:23 pm
by JimmyHartington
Thanks Magnus for the example.
In my current use case I will use the other idea with scaling the content, which overlaps the media box.