Hi everyone,
I have a CDT CDT type process variable called pv!caseIds, which contains a column showing case IDs as below:
[caseIDs=1, deleteDate=11/12/2001 17:30 GMT+11:00],[caseIDs=2, deleteDate=11/12/2001 17:30 GMT+11:00],[caseIDs=3, deleteDate=11/12/2001 17:30 GMT+11:00],[caseIDs=-1, deleteDate=11/12/2001 17:30 GMT+11:00],[caseIDs=-2, deleteDate=11/12/2001 17:30 GMT+11:00],[caseIDs=10, deleteDate=11/12/2001 17:30 GMT+11:00],[caseIDs=3030064, deleteDate=11/12/2001 17:30 GMT+11:00]
I also have a text list of case IDs, saved in another process variable called pv!caseIdText = {1,2,-2}
Now I want to find all the case IDs in pv!caseIds.caseIds column that ARE NOT in pv!caseIdText (which are {3,-1,-2,10,3030064})
I tried using difference() as below:
difference((pv!caseIds.caseIds, pv!caseIdText)
and got this error message: Expression evaluation error at function 'difference' parameter 1 [line 2]: Invalid index: Cannot index property 'caseIds' of type Text into type Document) (Data Inputs)
How can I do the comparison and find the differences in this situation? Or how can I change the data type so that they match?
Thanks a lot!
Discussion posts and replies are publicly visible
Hi, fn!difference will work but you're right that the data types of both inputs need to match. You can wrap each with fn!tointeger so that you're comparing a list of int to a list of int.
However, based on the error message you provided something else is going on - Appian isn't able to index "caseIds" from your pv!caseIds. It looks like that might be a casing issue, the CDT looks like it has the "D" in "IDs" capitalized, so when you use fn!index you'll need to provide matching casing.
I used toInteger() and fixed all unmatching cases but the error message is still there...
Can you confirm the type you set for the PV? From the error message it looks like "Document", which may be the problem if that is Appian's Document object type instead of your CDT type.