Nested IF statements

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
bwalk
Posts: 55
Joined: Thu May 10, 2018 12:10 am

Nested IF statements

Post by bwalk »

Good Day Devs,
Can someone please tell me if we can do 'Nested' IF statements in BO Rules? If not how do you accomplish the equivalent?
Thanks
PointsWell
Posts: 1463
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Nested IF statements

Post by PointsWell »

bwalk wrote:Good Day Devs,
Can someone please tell me if we can do 'Nested' IF statements in BO Rules? If not how do you accomplish the equivalent?
Thanks
Do you mean If a condition holds then does another condition apply?

Yes, but not in the same Process. What you can do is create sub processes to apply the additional conditions

Eg:
Process

Code: Select all

IF Condition = 'X’THEN SubProcessA ELSE...
SubProcessA then receives any BO that you are testing as an input and

Code: Select all

IF Condition2='1’THEN some action
bwalk
Posts: 55
Joined: Thu May 10, 2018 12:10 am

Re: Nested IF statements

Post by bwalk »

Thanks for the responce PointsWell.
This could lead to a very large # of processes couldn't it? 100s, 1000s?
And would it not be very difficult to read? To get the big picture of what you are building?
Probably just needing to learn how to think differently on my part but it seems like it would be difficult (for me that is)
Thanks again,
PointsWell
Posts: 1463
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Nested IF statements

Post by PointsWell »

bwalk wrote:Thanks for the responce PointsWell.
This could lead to a very large # of processes couldn't it? 100s, 1000s?
And would it not be very difficult to read? To get the big picture of what you are building?
Probably just needing to learn how to think differently on my part but it seems like it would be difficult (for me that is)
Thanks again,
Two views:
Cons:
Fragmented processes
Lots of processes

Pros
Clearer code
Higher levels of reusability (potentially)

With regards to ease of identification and organisation there are a couple of things you can do:
  1. Use Categories to place related processes together. These can only be one level deep though
  2. Use the "Place under" to group related processes together
  3. Use a naming convention for your processes
I rely on points 1 and 3. For example I create a Category say "Contacts"
Then I place all my contacts related processes in this category and then name them appropriately
eg
ContactsCreateNew_000Start
ContactsCreateNew_100AddressDetails
ContacsCrreateNew_200ProductAreas
etc etc.

This has the benefit of being highly visible within the Console when things are happening. I know that I have a process related to Contacts running and it is a Creation process and that it is at step x. Also it is self ordering (as long as you have a numeric element) when you add new processes within the gaps of the number sequences.

I would preface that by adding I spend some time using BPMN notation to build the process (Camunda is a decent open source modeller), so I have a clear view of how things are going to play out. I am very much looking forward to the next version of AIM being able to diagram those resulting processes out.

Also bear in mind that a process will affect ALL of the BOs in context. So sub processes are the way to isolate individual BOs when you have an array of them in context, e.g. FIND Contacts WHERE Contacts.Attribute='x' this will potentially return multiple BOs if you were able to use nested IFs then you have a challenge as to which instance of the BO you are affecting.
bwalk
Posts: 55
Joined: Thu May 10, 2018 12:10 am

Re: Nested IF statements

Post by bwalk »

Hello PointsWell,
This will help a great deal in keeping things organized and yes, I heard (but had forgotten) the next version of AwareIM would be able to do that. That will be a big help.
I will continue to try to learn my way around this very powerful development tool.
Thank you for the detailed guidance.
Bill Walker
PointsWell
Posts: 1463
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Nested IF statements

Post by PointsWell »

bwalk wrote:Hello PointsWell,
This will help a great deal in keeping things organized and yes, I heard (but had forgotten) the next version of AwareIM would be able to do that. That will be a big help.
I will continue to try to learn my way around this very powerful development tool.
Thank you for the detailed guidance.
Bill Walker
My pleasure.
Post Reply