Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
j_nlucas
Partner - Contributor III
Partner - Contributor III

Validate all values in an input box

Hello,

I've got an input box where the user will introduce a list of values that I will filter in some field.

The values must be numbers with two decimals maximum and they'll be separated by the symbol "|". So an example of a correct entry would be:

4565.34|445|125543.56|90

and an example of a wrong entry would be:

4565.34|445|125543.56|90.776 or d4565.34|445|125543.56|7aab....

I know how to check if one item of the list meets the conditions, but I don't know how to iterate it to all items in the list.

Any idea?

1 Solution

Accepted Solutions
j_nlucas
Partner - Contributor III
Partner - Contributor III
Author

I found a solution that is good enough:

=(len($)>0 and len(purgechar($,'0123456789.|')) = 0 and index($,'..')=0) or len($)=0

View solution in original post

2 Replies
petter
Partner - Champion III
Partner - Champion III

You can use this expression to give a true or false value depending on whether each list value is a number or not

so it is easy to extend from there:

=$(=Concat( 'IsNum(''' & SubField( vInputVar ,'|' , ValueLoop(1,SubStringCount(vInputVar,'|')+1)) & ' '')', ' AND ' ))

It can be generalized into a "function-variable" by using parameters too...

j_nlucas
Partner - Contributor III
Partner - Contributor III
Author

I found a solution that is good enough:

=(len($)>0 and len(purgechar($,'0123456789.|')) = 0 and index($,'..')=0) or len($)=0