divyam
Novice

How to get the length of a string?

Jump to solution

I have a workflow where I want to get the length of a string (Eg: TE00000284) to use it in further cases.

I tried using fn_Length(TE00000284) in 'Convert Value' Action and tried to store the length in number variable and

TE00000284 has been passed in single line text variable.

But, unfortunately it's throwing an error stating

"Error parsing value. Value 'fn_Length(TE00000284)' is not compatible with the selected output variable type Number (double)."

Please help me with the error...

0 Kudos
Reply
8 Replies
shrinivasnaik

Re: How to get the length of a string?

Jump to solution

Hi Divya,

I tried this myself and could not find the error. Are you using a hardcoded string to check the length (TE00000284) or are you checking the length of the string that is stored in a textbox? Can you try using a string variable to store the count?

Regards,

Shrini

0 Kudos
Reply
divyam
Novice

Re: How to get the length of a string?

Jump to solution

Hi Shrini,

Thankyou.

I'm taking the string value from list column. Anyways I tried both cases as well (mentioned above) but getting the same error.

0 Kudos
Reply
shrinivasnaik

Re: How to get the length of a string?

Jump to solution

Hi Divya,

I have tried this quite some time before as well and it does give the correct result. Could you please copy paste your actions (images) to show what exactly you are doing?

Regards,

Shrini

0 Kudos
Reply
burkslm
Novice

Re: How to get the length of a string?

Jump to solution

Try setting the variable that gets the length to an integer.

0 Kudos
Reply
divyam
Novice

Re: How to get the length of a string?

Jump to solution

This is the workflow I'm using and dont know where I went wrong..

I took two variables as below

I have taken the string value from current item and assigned it to Sting variable.

In Convert Value I used the function fn_Length(String) to get length of string passed and stored the value in Number variable. And tried to log the value.

But I'm getting the same error as mentioned above... Please help me in resolving this issue.

0 Kudos
Reply
shrinivasnaik

Re: How to get the length of a string?

Jump to solution

Hi Divya,

It seems a bit odd, I tried very quickly creating the same workflow you showed above (just to be sure if i am not seeing anything) and there was nothing wrong in it. The only thing I can think of what is the data type of the "Sequence Number" field? Could you try the following (this may not solve your issue but can help you troubleshoot your issue further)

1] Get details from soem other field other than sequence number shown above, see if it works ..

2] Use trim with the length function so that spaces dont get counted.

Further it looks very straightforward and not sure what exactly could be wrong other than the field sequence number as thats the only unknown in this scenario. Try this and let me know if it works.

Regards,

Shrini

0 Kudos
Reply
divyam
Novice

Re: How to get the length of a string?

Jump to solution

Thankyou everyone.

It is working fine now. I really found my mistake where I used fn_Length(String) instead of fn-Length(String) Hence it was throwing an error.

Now it is working fine ...

Thankyou again

View solution in original post

0 Kudos
Reply
JohanEsteban92

Re: How to get the length of a string?

Jump to solution

hola , 
esta tambien es una manera en la que pude optener el tamaño de una cadena que tienen numeros sin que me presentara error, poniendo antes de la variable o el control ""  y concatenarlo con un +

length(""+IDNo)
0 Kudos
Reply