Find whether primary key contains "true" tied to secondary key

Hi there,

I’m working on a small problem here.

I’d like to come up with a rule or expression that will allow me to update the Boolean status tied to a “secondary” key.

Here’s an example:

I need to update job_status to “complete” and completed to “true” for id 3818276.

I can verify whether or not an id can be changed to “complete” by checking the job_id
In other words: "if the job_id contains “complete” in job_status , then change job_status to “complete” for any id tied to job_id

Thank you!

Hi @tb_g_23

A way to solve it is to create a string of job statuses and check if the word complete is present. Assume this example:
image

With job_id as grouping column, you can make a unique concatenate with all the job statuses.

With an inner join from the Joiner node, you can pass this value along to the main data flow.

If you then evaluate if this string contains the word “complete”, you can update the job_status subsequently. You could for example use a Column Expression node to perform this rule evaluation and update.

if (contains(column("Unique concatenate with count(job_status)"),"complete") == true) {
    "complete"
} else {
    column("job_status")
}

Hope this helps!

1 Like

Thank you! This works.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.