Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to use a variable to check whether or not a certain value exists in a field.
This is what I have:
Let vArchive = If(Match('Archive', 'ArchiveCost'), True(), False())
Archive is a field in a table, and I'm checking to see if ArchiveCost exists as a value.
Right now, it returns False even when the value does exist. Is there a better way to do this than the Match() function?
Thanks!
Ah, you are looking for a script only solution, right? I missed that and posted an expression for the front end.
Try
Let vArchive = If(Exists('Achive','ArchiveCost'),True(),False());
Single quotes around Archive field name are mandatory.
Maybe
= If( Sum( Match([Archive], 'ArchiveCost')), True(), False())
Temp:
load * inline [
Archive
1,
2,
3,
3,
3,
ArchiveCost
];
AllValuesInArchiveTable:
load
Concat(distinct [Archive], '|') as AllValuesInArchiveField
Resident Temp;
let vAllValuesInArchive = peek('AllValuesInArchiveField',-1,'AllValuesInArchiveTable');
drop table AllValuesInArchiveTable;
Let vArchive = If(index('$(vAllValuesInArchive)', 'ArchiveCost')>0, 1, 0);
This one isn't working, it's returning an error:
Unexpected token: ',', expected nothing: Let vArchive = If(Sum(Match([Archive], 'ArchiveCost'))>>>>>>,<<<<<< True(), False())
You Can try this.
Let vArchive = If(wildmatch(Archive, 'ArchiveCost'), True(), False())
Regards,
Kaushik Solanki
Ah, you are looking for a script only solution, right? I missed that and posted an expression for the front end.
Try
Let vArchive = If(Exists('Achive','ArchiveCost'),True(),False());
Single quotes around Archive field name are mandatory.
Thank you! This one works.