FIND records | not found | subroutine

If you think that something doesn't work in Aware IM post your message here
Post Reply
jannes
Posts: 100
Joined: Tue Jul 02, 2019 12:22 pm

FIND records | not found | subroutine

Post by jannes »

Table “Person” contains :
id name language
1 Jannes dutch
2 Chris english
3 Mark english
4 Jim english

Process : "DoFindSub" with just 1 rule :
LoggedInBackofficeUser.Cnt=LoggedInBackofficeUser.Cnt + 1


Test 1)
FIND Person WHERE Person.language = ‘english’
DoFindSub

Result : DoFindSub is executed 3 times : OK


Test 2)
FIND Person WHERE Person.language = ‘dutch’
DoFindSub

Result : DoFindSub is executed 1 time : OK

Test 3)
FIND Person WHERE Person.language = ‘french’
DoFindSub

Result : DoFindSub is executed 1 time : NOK ???
LoggedInBackofficeUser.Cnt is incremented by 1

I didn't expect this behaviour.
What do you think ?
Jaymer
Posts: 2454
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: FIND records | not found | subroutine

Post by Jaymer »

This makes sense.
The sub routine is always going to be called.
I’m sure you’ll see this in the logger.
The third time it gets called, but it didn’t get a person record passed to it in context, but it still got called.

Just add a simple statement.
IF SEARCH_COUNT > 0 THEN DoFindSub
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
Post Reply