Hello,
I am trying to trigger a query (called find_similar_parts_from_lot
) to filter the table assets
in a Postgres DB by 3 fields. Here is the query:
select * from assets
where asset_type = {{asset_type_id_to_match}}
and base_part_num = {{base_part_num_id_to_match}}
and orig_lot = {{orig_lot_id_to_match}};
Here is my function (defined globally) to trigger the query:
async function get_similar_assets (similar_assets_query, target_asset_type_id, target_base_pn_id, target_orig_lot_id) {
return Promise.resolve(similar_assets_query.trigger({
additionalScope: {
asset_type_id_to_match: target_asset_type_id,
base_part_num_id_to_match: target_base_pn_id,
orig_lot_id_to_match: target_orig_lot_id
},
})).then((data) => data.number_in_lot);
}
I call this function from the console to test it as follows:
get_similar_assets (find_similar_parts_from_lot, "829b63a3-e5f4-4daf-ad6b-ee287c7d2e7f", "d6dde309-49f8-469a-b736-6a60d07a5017", null)
When I call the function, it does trigger the query, but does not pass in the additional scope variables, and I get an empty result (just the column names). After the function call, when I look at the query in the state viewer, its query
field is:
select * from assets where asset_type = and base_part_num = and orig_lot =
So it looks like empty strings got passed in instead of my arguments. What am I doing wrong here?