Comparing part of the value of an integer with a part of the value of a float

13
In my current project, I would like to compare the first digits of an integer with the first four digits of a float. How can I do this to check whether these numbers are the same or not?
asked
1 answers
6

You can use a microflow expression, below is the complete expression I will explain what is does: You should have to integer or float variables, this can be separate microflow variables, an attribute or a static nr. This expression starts with converting the numbers to strings. Then the first 4 digits from both the numbers will be substracted. There will be 2 strings containing the 4 digits. if they are equal this expression returns true.

substring( toString($NrVar1), 0,4) = substring( toString($NrVar2), 0,4) 

**Example:** 
$NrVar1 = 123456789;  $NrVar2 = 123498765;
substring( toString(123456789), 0,4) = substring( toString(123498765), 0,4) ;
substring( '123456789', 0,4) = substring( '123498765', 0,4) ;
'1234' = '1234' ;
true;
answered