SOLVED: A size limitation exists for conditionals

If you think that something doesn't work in Aware IM post your message here
Post Reply
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

SOLVED: A size limitation exists for conditionals

Post by JonP »

How is this possible? I have an attribute that the log viewer separately evaluates to true and false for the same comparison when the value is UNDEFINED. I just included the lines that matter and rearranged the sequence for ease of comparison.

Evaluating condition AssessmentStateSurvey.sc_Priority>0
Condition evaluated to false: <UNDEFINED>>0
Condition evaluated to true: <UNDEFINED>>0

Evaluating condition AssessmentStateSurvey.sc_Priority=0
Condition evaluated to false: <UNDEFINED>=0
Condition evaluated to true: <UNDEFINED>=0
Attachments
UNDEFINED issue.png
UNDEFINED issue.png (208.86 KiB) Viewed 19649 times
Last edited by JonP on Sat Nov 17, 2018 9:48 pm, edited 1 time in total.
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by PointsWell »

I am assuming that sc_Priority is a shortcut?

If so try doing your evaluation to the referenced object directly

eg IF BO.ps_Priority.Code>20 THEN xxxx

I've had issues with evaluating shortcuts in HTML (different to what you are doing I know) but I found that evaluating against the actual referenced item worked whereas the shortcut didn't.
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by BobK »

Every where the condition evaluated to true, like
Condition evaluated to true: <UNDEFINED>>0
you were using "NOT (AssessmentStateSurvey.sc_Priority>0)"
So the condition evaluated to false and the NOT changed to to true

It may not be in your code, but if your actual condition uses ELSE, Aware might be generating the NOT
Bob
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

One of my conditions is being ignored

Post by JonP »

Good catch, Bob. That's embarrassing. I'm actually not using NOT in my conditions, but for some reason, AIM does when it evaluates them.

Regardless, I'm still having a problem with AIM evaluating the conditions properly. I have a sequence of 6 If/Then statements. AIM steadfastly refuses to evaluate one of them (2nd from last). I've tried changing the order and rewording the if statement (including using Mark's suggestion of not using the shortcut shown below) to no avail.

Code: Select all

If AssessmentStateSurvey.Factor.AverageRelevance>0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
  LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: '+AS_STRING(AssessmentStateSurvey.sc_Priority)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},' 
 Else If AssessmentStateSurvey.Factor.AverageRelevance>0 Then
  LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: '+AS_STRING(AssessmentStateSurvey.Factor.AverageRelevance)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},' 
 Else If AssessmentStateSurvey.Factor.AverageRelevance=0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
  LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},' 
 Else If AssessmentStateSurvey.Factor.AverageRelevance=0 Then
  LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},' 
 Else If AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
  LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},' 
 Else
  LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},' 
The weird thing is, if I change the instance that is being bypassed from "Threat" to "Weakness", it gets evaluated. If I change it back to "Threat" and switch the if/then so that I check for "IN Strength, Weakness" and have Opportunity/Threat as the catch-all "Else", there is no difference in the result. I checked the FIND statement (shown below) and there is no reason for that instance not to be included.

Code: Select all

FIND AssessmentStateSurvey WHERE (AssessmentStateSurvey.AssessmentState=AssessmentState AND AssessmentStateSurvey.Person=LoggedInPerson AND AssessmentStateSurvey.ScoreValue IS DEFINED AND AssessmentStateSurvey.Type IS DEFINED AND AssessmentStateSurvey.Type<>'Not Sure') 
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by Jaymer »

Hey Jon,
weird thing is, if I change the instance that is being bypassed from "Threat" to "Weakness", it gets evaluated. If I change it back to "Threat" and switch the if/then so that I check for "IN Strength, Weakness" and have Opportunity/Threat as the catch-all "Else", there is no difference in the result. I checked the FIND statement (shown below) and there is no reason for that instance not to be included.
When you say you check the FIND statement.
Do you mean you looked in the logging window and you see that after the FIND statement there are the correct number of instances found?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by JonP »

Hey Jaymer,

I said that wrong. Yeah, FIND found 6 objects (the screenshot only shows 1 because I was trying IN BATCHES OF 1 to see if that would help) and actually did evaluate all 6. But it refused to trigger the condition when sc_Priority (or equivalent) IS UNDEFINED and Type = Opportunity or Threat. Oddly, it has no problem when Type = Strength or Weakness and/or sc_Priority is a number. All 6 should render because I have a catch-all Else condition. I used a DISPLAY MESSAGE to verify that only 5 are included in DataForSWOT.
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by BobK »

IMO AIM does not handle multiple Else If statements very well, I try to avoid them.
Bob
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by JonP »

What's the alternative?
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by PointsWell »

JonP wrote:FIND found 6 objects (the screenshot only shows 1 because I was trying IN BATCHES OF 1 to see if that would help) and actually did evaluate all 6. But it refused to trigger the condition when sc_Priority (or equivalent) IS UNDEFINED and Type = Opportunity or Threat.
If you have multiple items returned from a FIND it is better to evaluate them in a sub process otherwise it will evaluate the last item in the FIND.

As for sc and undefined I would try evaluating against the actual referred item instead of the shortcut.
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by BobK »

Multiple rules.

Rule 1
If AssessmentStateSurvey.Factor.AverageRelevance>0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: '+AS_STRING(AssessmentStateSurvey.sc_Priority)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
Else If AssessmentStateSurvey.Factor.AverageRelevance>0 Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: '+AS_STRING(AssessmentStateSurvey.Factor.AverageRelevance)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'


Rule 2
If AssessmentStateSurvey.Factor.AverageRelevance=0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
Else If AssessmentStateSurvey.Factor.AverageRelevance=0 Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'


Rule 3
If AssessmentStateSurvey.Factor.AverageRelevance<0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
Else If AssessmentStateSurvey.Factor.AverageRelevance<0 Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'


edit
REMOVED

edit 2
disregard edit 1, it did not make mush sense. My only excuse is that I was in a hurry and not thinking clearly.
Last edited by BobK on Sat Nov 17, 2018 7:31 pm, edited 2 times in total.
Bob
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by PointsWell »

BobK wrote:Multiple rules.

Rule 1
If AssessmentStateSurvey.Factor.AverageRelevance>0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: '+AS_STRING(AssessmentStateSurvey.sc_Priority)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
Else If AssessmentStateSurvey.Factor.AverageRelevance>0 Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: '+AS_STRING(AssessmentStateSurvey.Factor.AverageRelevance)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'


Rule 2
If AssessmentStateSurvey.Factor.AverageRelevance=0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
Else If AssessmentStateSurvey.Factor.AverageRelevance=0 Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'


Rule 3
If AssessmentStateSurvey.Factor.AverageRelevance<0 AND AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
Else If AssessmentStateSurvey.Factor.AverageRelevance<0 Then
LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',y: 0,size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`,color: `blue`},'
This will be very inefficient as it will trigger three rules instead of one. Each one checking everything. If the Business Rule is not working with multiple if/else if then define the condition for a process and pass it off to that, then it would trigger only once.

Using this multiple Business Rule approach can have multiplying effects if you have forgotten to switch off Referred Rules on the related Business Objects.

On rereading the issue I have another question.

Are you trying to use FIND in a business rule? If so you are setting yourself up for a world of pain especially if it returns more than one BO. Definitely pass this off to a Process.

Also if the IN ‘Threat’, ‘Weakness’ is not working have you checked using BO.attribute=‘Threats’ OR Bo.attribute =‘Opportunity’
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by JonP »

Thanks Mark,

Yeah, I'm using processes, not rules in this case. If all I did was add-to DataForSWOT with each new instance, then I could use rules. But sometimes I have to wipe DataForSWOT and re-populate it for an updated instance, so processes work better.

I've been using a sub-process after the FIND for that conditional. There's no other way to do it that I know of since you can't place an If statement directly after a FIND statement (without stuffing it in a sub-process) I don't think. I tried it with and without batches of 1.

I also tried replacing the IN syntax with the clunkier OR syntax. No luck.
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by PointsWell »

I’m Sean. Mark is Eagle99

I’m out of ideas then. My suggestion of last resort is a debug with DISPLAY MESSAGE and checking the values of expected attributes at various stop points.
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

Re: <UNDEFINED>=0 and <UNDEFINED>>0 evaluated to true AND fa

Post by JonP »

Sorry Sean, brain fart. Thanks for your efforts.
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
JonP
Posts: 287
Joined: Thu Feb 16, 2017 9:49 pm
Location: United States

SOLVED: A size limitation exists for conditionals

Post by JonP »

I decided to split the conditional sub-process into two sub-sub-processes and it worked. The sub-process was changed to this:

Code: Select all

If AssessmentStateSurvey.Type IN 'Opportunity', 'Threat' Then
 BuildIndExtSWOT_Matrix
Else 
 BuildIndIntSWOT_Matrix
The first sub-sub-process (BuildIndExtSWOT_Matrix) looks like this:

Code: Select all

If AssessmentStateSurvey.Factor.AverageRelevance>0 Then
 LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: '+AS_STRING(AssessmentStateSurvey.sc_Priority)+',category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`},' 
Else If AssessmentStateSurvey.Factor.AverageRelevance=0 Then
 LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 0.05,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`},' 
Else
 LoggedInPerson.DataForSWOT=LoggedInPerson.DataForSWOT+'{x: 0,y: '+AS_STRING(AssessmentStateSurvey.ScoreValue)+',size: 3,category: `'+AS_STRING(AssessmentStateSurvey.sc_Factor)+'`},' 
The logic for this approach vs the previous approach is EXACTLY THE SAME. Therefore I can only conclude that there is a size limitation for conditionals above which they become unstable. Bob, I can see why you stick to rules. Now I'm getting a little paranoid about my other conditionals.
v8.1 on Windows 10 / MySQL 5.6 (local), v8.1 on Windows Server 2016 / MySQL 5.6 (server)
Post Reply