Skip to main content
February 9, 2025
Solved

query process variable of record type

  • February 9, 2025
  • 5 replies
  • 0 views

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
)

Best answer by stefanhelzle0001

Sure, but the parameter "recordType" MUST be a direct record type reference. There is no way around this.

5 replies

stefanhelzle0001
February 9, 2025

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.

February 9, 2025

The PV is record type hence I used query record type. How to filter pv of record type using another record type pv variable ?

venkatrea696188
February 9, 2025
[quote userid="300554" url="~/discussions/f/new-to-appian/38487/query-process-variable-of-record-type"] pv!filt_table['recordType!{73b2f9fb-792e-446d-97e2-320d538e9c47}Tst_act_table.fields.{4d7e433e-cc66-46db-9a2d-2f2b6218a819}accountId'], /* Must match format */
operator: "in",[/quote]

You are passing process variable in field parameter of query filter , It's just record!Act_table.accountid . Please correct it

February 9, 2025

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.

stefanhelzle0001
February 9, 2025

Sure, but the parameter "recordType" MUST be a direct record type reference. There is no way around this.