This portion of my process depends on the availability of data in the datatable. I query a sql table that is expected to have only two distinct values (2 and 4). And 2 and 4 are Business Units having errors.
Let me explain what I mean by that.
When we find only one distinct number let’s say 2, the process will continue with the other Business Unit that has no error (business unit 4). However, there should be an email send out stating that Business Unit 2 has error, please fix it.
The same way, when we find only one distinct number let’s say 4 this time around, the process will continue with the other Business Unit that has no error (business unit 2) while sending out email stating that Business Unit 4 has error, please fix it.
The third scenario is both Business Unit 2 and 4 being distinct values, meaning both the Business units having errors - in such a case we send out email stating that Business unit 2 and 4 have errors, this time there is no next step, the process stops here.
Is there anyone who can give me an idea on how to design/ handle this logic?
Please let me know if you need more clarification about my ask.
Thank you for looking into this
It is going to look like the following -
FYI - the data table has max of 2 rows - my process can handle if this record is just either 2 or 4. However, if the max number of records (2 records,) 2 and 4 the process should stop. It cannot continue to the next step - in such a case for each row in data table does not help - there should be a way we can tell that when the DT has 2 and 4 values send email and stop the process TestScenario.zip (74.8 KB)
So, I am still trying to figure how I can convert values in DT to list and then if the value of the list is just one and equal to 2, if the value of the list is just one and equal to 4, if the value of the list 2 and 4.
While trying to go through the attached workflow, please try to refer the prior post.
Unfortunately, I cannot share actual data and flow
Thanks!
I think you got the design right that the dt_forBU2and4 has either no data or distinct # 2 (value) or distinct # 4 (value) or distinct # 2 and 4 (values). Depending on the value of the rows equal to the above (# 2, # 4, # 2 and # 4), different actions (decisions) are taken. However, your query (dt_forBU2and4.AsEnumerable.Sum(Function(r) CInt(r(“ColumnName”)))) looks like it does the summation - forgive me if I got it wrong.
I was trying to use IF condition for each of the three scenarios
Scenario 1 - IF BU2: dt_forBU2and4.AsEnumerable().Any(Function(row) row(“ColumnName”).ToString() = “2”)
Scenario 2 - IF BU4: dt_forBU2and4.AsEnumerable().Any(Function(row) row(“ColumnName”).ToString() = “4”)
Scenario 3 - IF BU2 and BU4 : dt_forBU2and4.AsEnumerable().Any(Function(row) row(“ColumnName”).ToString() = “2”) AndAlso dt_forBU2and4.AsEnumerable().Any(Function(row) row(“ColumnName”).ToString() = “4”)
The problem with above queries (3 scenarios) is, for example, IF data for “2” and “4” are present, Scenario 1 and Scenario 2 get executed - when both “2” and “4” are present - I want only to be executed by Scenario 3. Scenario 1 is expected to be executed only when there is one record in the data table (dt_forBU2and4) which is “2”, and Scenario 2 is expected to be executed only when there is one record in the data table (dt_forBU2and4) which is “4”
I hope this explanation makes it clear now. Again, please let me know if you’d need any info.
Your understanding is correct. If there are just single “2” and single “4” in the datatable, summation will always be “6”.
The problem with above queries (3 scenarios) is, for example, IF data for “2” and “4” are present, Scenario 1 and Scenario 2 get executed - when both “2” and “4” are present - I want only to be executed by Scenario 3. Scenario 1 is expected to be executed only when there is one record in the data table (dt_forBU2and4) which is “2”, and Scenario 2 is expected to be executed only when there is one record in the data table (dt_forBU2and4) which is “4”
IF you want to use IF activity, can you try to use “All” as the following?
Scenario 1 - IF BU2: dt_forBU2and4.AsEnumerable().All(Function(row) row(“ColumnName”).ToString() = “2”)
Scenario 2 - IF BU4: dt_forBU2and4.AsEnumerable().All(Function(row) row(“ColumnName”).ToString() = “4”)
Scenario 3 - IF BU2 and BU4 : dt_forBU2and4.AsEnumerable().Any(Function(row) row(“ColumnName”).ToString() = “2”) AndAlso dt_forBU2and4.AsEnumerable().Any(Function(row) row(“ColumnName”).ToString() = “4”)