Hi,
I have a question re the order of using nested if's in PQ,
I want to make 'numbers" = 1000 and text strings thant start with 'a' = "AAA , if first tried this,
Does not work;
Table.ReplaceValue( Source, "", "" , (x,y,z)=>
if Text.Start(x,1) = "a" then "AAA" else
if Value.Type(x) = type number then 10000 else x ,
Cols )
The first if does but I get an error for numbers, so I changed the order and this works
Works;
Table.ReplaceValue( Source, "", "", (x,y,z)=>
if Value.Type(x) = type number then 10000 else
if Text.Start( x,1) = "a" then "AAA" else x ,
Cols )
I can't see why they outcome should differ? I have tried by putting an if to text if it is text before taking the first value but still no good,
Table.ReplaceValue( Source, "", "" ,
(x,y,z)=>
if Value.Type(x) = type text then if Text.Start(x,1)= "a" then "AAA" else
if Value.Type(x) = type number then 1000 else x else x ,
Cols )
Can someone point out the evaluation order ?
Richard.
Bookmarks