Hello,
I am quite new to PQL and I tried to assign costs to spesific activities depending on the predecessor.
When B is followed by C, only C should be assigned with certain costs. When A is followed by C, again C should be assigned with costs, but with a different value. The result should look like this:
CaseID | Time | Activity | Costs |
---|---|---|---|
150488 | 07:34 | A | |
150488 | 08:30 | B | |
150488 | 09:23 | C | 0,84 |
150488 | 09:45 | D | |
150488 | 10:34 | A | |
150488 | 11:45 | C | 1,56 |
150488 | v | E |
I tried this with the following code:
CASE
WHEN "ActivityTable"."Activity" = 'C'
AND MATCH_PROCESS_REGEX (
"ActivityTable"."Activity",
'A' >> 'C'
) = 1
THEN 1.56
WHEN "ActivityTable"."Activity" = 'C'
AND MATCH_PROCESS_REGEX (
"ActivityTable"."Activity",
'B' >> 'C'
) = 1
THEN 0.84
ELSE 0
END
Unfortunately the table looks like that, so it assigns the wrong costs:
CaseID | Time | Activity | Costs |
---|---|---|---|
150488 | 07:34 | A | |
150488 | 08:30 | B | |
150488 | 09:23 | C | 1,56 |
150488 | 09:45 | D | |
150488 | 10:34 | A | |
150488 | 11:45 | C | 1,56 |
150488 | v | E |
Do you have a solution for this problem? Thank You!
BR, Michael