I have two process variable bkk_act_id,filt_table. Both are record type of two different table with common Account_id. I want to use account list in the first table to filter the second table rows containg that Account_id. While this work if I use the record type directly, but when I try to do the same with process variable its throwing error for both the variable processing:
Expression evaluation error at function a!queryRecordType [line 11]: Could not cast from Tst_act_list to RecordType. Details: CastInvalid) (Data Outputs)
a!localVariables( local!accountIds: index( a!queryRecordType( recordType: pv!bkk_act_id, pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5000) ).data, pv!bkk_act_id['recordType!{c1a6fae6-0413-4ce9-b777-4bf0906e36a2}Tst_act_list.fields.{50cfb814-61d1-4617-9005-25befed5abe7}accountId'], {} ),
local!filteredData: a!queryRecordType( recordType: pv!filt_table, /* Table to filter */ filters: a!queryFilter( field: pv!filt_table['recordType!{73b2f9fb-792e-446d-97e2-320d538e9c47}Tst_act_table.fields.{4d7e433e-cc66-46db-9a2d-2f2b6218a819}accountId'], /* Must match format */ operator: "in", value: local!accountIds ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 5000) ).data,
local!filteredData)
Discussion posts and replies are publicly visible
In lines 4 and 12, for the recordType parameter, you have to reference the record type, but not a PV. Check the documentation for how to use that parameter.
This makes your code more readable.
sathyan315869 said: pv!filt_table['recordType!{73b2f9fb-792e-446d-97e2-320d538e9c47}Tst_act_table.fields.{4d7e433e-cc66-46db-9a2d-2f2b6218a819}accountId'], /* Must match format */ operator: "in",
You are passing process variable in field parameter of query filter , It's just record!Act_table.accountid . Please correct it
This code works fine when using record type. But I want to filter one process variable(flt_table) using another process variable(pv!bkk_act_id). Both have account_id. In sql: select * from pv.flt_table where Account_id in (select Account_id from pv.bkk_act_id). Both pv are record type.
The PV is record type hence I used query record type. How to filter pv of record type using another record type pv variable ?
Sure, but the parameter "recordType" MUST be a direct record type reference. There is no way around this.