For those who have used Dataflow in the past and migrated to Recipe recently, some of the syntax and function are different from SAQL in Dataflow.
1. string
use ' instead of "
use ' instead of "
in SAQL, case when 'Data.Name' is null then "No" else "Yes" end
in SAQL, case when "Data.Name" is null then 'No' else 'Yes' end
2. equal in comparison
use = instead of ==
3. instr() to replace index_of()
Syntax: instr(field, searchString, [position, [occurrence]])
instr('123!456!78!', !) -- the result is 4
instr('123!456!8!', !, [4]) -- the result is 7
instr('123!456!8!', !, [4, [2]]) -- the result is 9
case when instr(Email, '@ap') > 0 then 'APAC' when instr(Email, '@eu') > 0 then 'EMEA' else 'AMER' end
Syntax: instr(field, searchString, [position, [occurrence]])
instr('123!456!78!', !) -- the result is 4
instr('123!456!8!', !, [4]) -- the result is 7
instr('123!456!8!', !, [4, [2]]) -- the result is 9
case when instr(Email, '@ap') > 0 then 'APAC' when instr(Email, '@eu') > 0 then 'EMEA' else 'AMER' end
4. to_timestamp() to replace toDate()
in SAQL, case when 'Region' == "APAC" then toDate("2024-01-06 21:00:00")
else toDate("2024-01-07 11:00:00") end
in SAQL, case when "Region" = 'APAC' then to_timestamp('2024-01-06 21:00:00') else to_timestamp('2024-01-07 11:00:00') end
Output type from to_timestamp is Date Time
Reference:
No comments:
Post a Comment