How to use difference() to find the differences between CDT process variable and list of text process variable?

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

Parents
  • 0
    Certified Lead Developer

    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.

Reply
  • 0
    Certified Lead Developer

    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.

Children