I am an trying to verify column type of each row in excel sheet against an array having type numbers
TESTCASES:
test1:{"1","abc"} passes
test2:{"abc","abc"} also passes which should actually fail .Please let me know where it went wrong
code used ,
local!error:a!forEach( items:index(ri!data,"values"), expression:{ a!localVariables( local!rowNumber:fv!index, a!forEach( items: fv!item, expression:{ if(a!isNotNullOrEmpty(fv!item), if(typeof(cast(local!types[fv!index],fv!item))=local!types[fv!index],{},"Type does not match at Row"&local!rowNumber&" and column"& fv!index), {} ) } ) )
}
),
Discussion posts and replies are publicly visible
kowsalyavijayan said:typeof(cast(local!types[fv!index],fv!item))=local!types[fv!index]
This will always match as you cast a value to the type you compare to.
At least this is what I see this code snippet doing .....
is there any alternate way to do this.
Sure. Do NOT cast the value.
typeof(fv!item)=local!types[fv!index]
But keep in mind that I am not sure I fully understand what you are doing.
I changed my logic to regex , test cases works fine for Integer, can you help me who to write regex for date
^(3[01]|[12][0-9]|0?[1-9])(\/|-)(1[0-2]|0?[1-9])\2([0-9]{2})?[0-9]{2}$ this works