Jump to content
Macro Express Forums

Variable weirdness


Rustywinger
 Share

Recommended Posts

Ok, I am going nuts!

 

If Variable %T93% does not contain "A"

OR

If Variable %T93% does not contain "B"

If Variable %N34% = 0

OR

If Variable %N34% = 2

// Clicks Select on Client Search window

Mouse Move Screen 550, 400

Text Box Display: this did NOT just happen!!!

Mouse Left Button Click

End If

Else

If Variable %N34% = 1

Variable Set String %T50% "%T51%"

End If

End If

 

 

The text box "This did NOT just happen" which I put in there to debug the code contains "T93=%T93%" and the result of that is a dialog containing "T93=B".

Why is this weird? Because if T93 really was B, that dialog box code should not be executed. Yet, it is.

 

I don't know what to do. It executes if it contains B and it executes if it does not contain B. (The A and B are assigned values from a 4-option multiple choice menu in which I selected B.)

Any suggestions?

 

Below is a portion of the code. The entire macro is over 100 lines long.

 

<IFVAR2:1:93:8:A>
  <OR>
<IFVAR2:1:93:8:B>
     <IFVAR2:2:34:1:0>
        <OR>
     <IFVAR2:2:34:1:2>
           <REM2:Clicks Select on Client Search window>
           <MMS2:550,400>
           <TBOX4:T:1:CenterCenter000278000200:000:this did NOT just happen!!!T93=%T93%>
           <LCLK>
      <ENDIF>
<ELSE>
      <IFVAR2:2:34:1:1>
           <TVAR2:50:01:%T51%>
      <ENDIF>
<ENDIF>

Link to comment
Share on other sites

Well it's an OR condition so that's correct. When T93 is B then it satisfies the first condion that it does not contain B. Since it's an OR either condition satisfied makes it true.

Link to comment
Share on other sites

Oops, sent to quick. In your multiple choice is result exclusive? IOW is it Radio Button or Checkbox? I'm trying to figure out what your intended logic is. Maybe if you could describe your desired logic in detail I could give you a better condition set.

Link to comment
Share on other sites

For multiple IF NOT conditions, you need to connect them with AND, not OR.

 

Consider a single-character variable containing the value A. Your condition

If Variable %T93% does not contain "A"

OR

If Variable %T93% does not contain "B"

is always true! In this case, the condition "does not contain B" is true.

If you'd written

If Variable %T93% does not contain "A"

AND

If Variable %T93% does not contain "B"

then you'd get the result you're seeking.
Link to comment
Share on other sites

Thanks for the replies, guys.

 

1- The Multiple choice menu that A and B come from (out of a possible A,B,C,D) is single choice only. The function it performs is to detect whether an ID number entered by a user was not found in the database, and if so, gives the user a multiple choice menu asking them what they would like to do- there are two flavors of creating a new DB entry for the ID number, which are 'A' and 'B'. 'C' is to re-enter the number in case it was wrong and 'D' aborts the macro entirely, cleaning up the session afterwards. This Macro links to several other Macros and can even perform and detect a loop of itself within the Macro (if that makes sense)

 

 

2- If I use an "AND" argument, that would mean I would have to have both "A" and "B" values in the variable, right? I want this to be either A or B.

 

 

3- This does not always happen- maybe 50% of the time (while I have been selecting 'B' exclusively) so I wonder what are the chances that ME is becoming a little unstable after awhile?

 

Here is the code in entireity-

 

Thanks!!!

 

 

REM2:><REM2:><REM2:_______________________________________________________________________><REM2:Create a Record Macro><REM2:----------------------------------------------------------------------------------------------------------------------------><REM2:><REM2:1-  Active Window Check><REM2:2- Collect Patient IDENTIFIER (Skipped if custom macro was just run)><REM2:3- Open blank record><REM2:4-  Handle %T50% IDENTIFIER Contents- Determine type (CR or HCN)><REM2:5-  Prompt clerk for action if no matches to the number><REM2:><VARSR:05><REM2:---------------------------Status Display Box---------------------------------------------------------><VSETMISC:T94:Name of Current Macro><MACRUN2:RunningDialogBox><REM2:---------------------------Status Display Box---------------------------------------------------------><REM2:><REM2:-----------------------------DIAGNOSTICS------------------------------------------------------------><MACRUN2:Diagnostics- Open screen><REM2:-----------------------------DIAGNOSTICS------------------------------------------------------------><REM2:><REM2:_______________________________________________________________________><REM2:1-  Active Window Check><REM2:----------------------------------------------------------------------------------------------------------------------------><REM2:_______________________________________________________________><REM2:Determine active screen><REM2:_______________________________________________________________><CAPCONTROL:F:3:1:000144,000060><REM2:><REM2:If a record window is open, it is closed.><REM2:If "Create Profile" has been run, this section is skipped (N26=1)><IFVAR2:2:26:2:T1><VARGETCONT:1:31><REM2:If N45=1 Close window is skipped.><IFVAR2:2:45:2:T1><IFVAR2:1:31:7:Tinformation><TBCLOSE:Running><REM2:Determine if Record has a billing number><CAPCONTROL:F:3:1:000300,000080><VARGETCONT:1:31><IFVAR2:1:31:1:T><TVAR2:31:01:A><TVAR2:33:01:UNSAVED><MENU2:2:T:31:CenterCenter:You must decide"The currently open record is: %T33%.

What would you like to do?Close this %T33% record and create a new record.
Oops, let me look at this %T33% record first.><ELSE><TVAR2:31:01:A><TVAR2:33:01:SAVED><MENU2:2:T:31:CenterCenter:You must decide"The currently open record is: %T33%.

What would you like to do?Close this %T33% record and create a new record.
Oops, let me look at this %T33% record first.><ENDIF><IFVAR2:1:31:1:TB><MRETURN><ENDIF><TEXTTYPE:<ESC>><MACRUN2:RunningDialogBox><ENDIF><ENDIF><REM2:><REM2:_______________________________________________________________><REM2:If a profile editor window is open, it is closed.><IFVAR2:2:45:2:T1><IFVAR2:1:31:7:TProfile><TBCLOSE:Running><MENU2:2:T:33:CenterCenter:You must decide"There is a Client Profile window currently open. What would you like to do?Close the profile window without saving it
Oops, let me look at this profile first.><IFVAR2:1:33:1:TB><MRETURN><ENDIF><TEXTTYPE:<ESC>><MACRUN2:RunningDialogBox><ENDIF><ENDIF><REM2:><VARSR:05><REM2:_______________________________________________________________________><REM2:2- Collect Patient IDENTIFIER (Skipped if custom macro was just run N26)><REM2:----------------------------------------------------------------------------------------------------------------------------><IFVAR2:2:26:1:1><BREAK><ELSE><REM2:If new profile has just been created, CR prompt is skipped.><IFVAR2:1:96:2:1><TOG:1><TVAR2:50:02:FPlease enter the CR# or HCN# of the patient:FFCenter:Center><TOG:2><ENDIF><VARSR:01><ENDIF><REM2:><REM2:_______________________________________________________________________><REM2:3- Open blank record><REM2:----------------------------------------------------------------------------------------------------------------------------><REM2:><REM2:_______________________________________________________________><REM2:Determine active screen><MMS2:39,38><LCLK><REM2:_______________________________________________________________><REM2:Checks screen resolution to locate button on bottom><IVAR2:11:15:><NMVAR:02:12:1:0000011:2:0000075><REM2:_______________________________________________________________><REM2:Clicks on "Billing"><MMS2:35,12N><LCLK><REM2:_______________________________________________________________><REM2:Clicks on "Ohip Billing"><MMS2:38,170><LCLK><REM2:_______________________________________________________________><REM2:Waits for Search Provider prompt box, then cancels it><TEXTTYPE:<TAB><TAB><ENTER>><TEXTTYPE:<ENTER>><DIS:<REM2:><REM2:This is the end of the N26 skip><ENDIF><REM2:_______________________________________________________________><REM2:Clicks on "Select Patient"><MMS2:775,75><LCLK><REM2:><REM2:_______________________________________________________________________><REM2:4-  Handle %T50% IDENTIFIER Contents- Determine type (CR or HCN)><REM2:----------------------------------------------------------------------------------------------------------------------------><MACRUN2:ID detection for use in NEW RECORD><WAITWIN2:000010:000000:Search Client><REM2:><IVAR2:45:01:0><REP3:08:000001:000002:0045:0:01:3><IFVAR2:2:34:1:0><OR><IFVAR2:2:34:1:2><REM2:><REM2:_______________________________________________________________><REM2:Handle an X,M,K,C Prefix or a 7-digit ID return><IFVAR2:2:45:2:2><GETCONTROL2:06:MED2020 CLINIC.EXE:ThunderRT6FormDCSearch Client002:1ThunderRT6Frame1ThunderRT6OptionButton><CCLICK:T:06:0:T:><TEXTTYPE:<TAB>%T50%<ENTER>><ENDIF><REM2:><REM2:Repeat until a result or until NO MATCH ><REP3:08:000001:000002:0033:0:01:16777215><MSD:20><IFOTH:04:2:No Match><IVAR2:45:01:2><BREAK><ENDIF><GETPX:33:S:000430:000200><IVAR2:45:01:3><ENDREP><MACRUN2:RunningDialogBox><REM2:><ELSE><REM2:><REM2:_______________________________________________________________><REM2:Handle an HCN return><IFVAR2:2:45:2:2><GETCONTROL:06:MED2020 CLINIC.EXE:003:ThunderRT6FormDCSearch ClientThunderRT6FrameThunderRT6OptionButton HCN><CCLICK:T:06:0:T:><MMS2:291,159><LCLK><TEXTTYPE:%T50%><TEXTTYPE:<ENTER>><ENDIF><REM2:><REM2:Repeat until a result or until NO MATCH ><REP3:08:000001:000002:0033:0:01:16777215><MSD:20><IFOTH:04:2:No Match><IVAR2:45:01:2><BREAK><ENDIF><IVAR2:45:01:3><IFOTH:12:2:Search Client><BREAK><ENDIF><ENDREP><MACRUN2:RunningDialogBox><REM2:><ENDIF><REM2:><REM2:_______________________________________________________________________><REM2:5-  Prompt clerk for action if no matches to the number><REM2:----------------------------------------------------------------------------------------------------------------------------><REM2:><REM2:If no match Prompt Clerk what to do><IFVAR2:2:45:1:2><TEXTTYPE:<ENTER>><MSD:200><TVAR2:93:01:A><MENU2:2:T:93:000230000263:The ID %T50% was not found in the 2020 database. If you have the patient's demographics on the bill, choose 'A' to create a new profile, if not, choose B to go into PCS to collect the DGs before creating a profile.Create a new Profile now from sheet demograpics
Get Demographics from PCS then create profile
Re-Enter the number
Exit the Macro><REM2:><REM2:If "B" selected, match Loop breaks.><IFVAR2:1:93:1:B><BREAK><ENDIF><REM2:><REM2:If "A" selected, match Loop breaks.><IFVAR2:1:93:1:A><BREAK><ENDIF><REM2:><REM2:If "D" selected, process is aborted><IFVAR2:1:93:1:D><MMS2:590,392><LCLK><TEXTTYPE:<ESC>><MRETURN><ENDIF><REM2:><REM2:If "C" selected Clerk chooses to refine number, looping back to beginning.><IFVAR2:1:93:1:C><TOG:1><TVAR2:50:02:FPlease re-enter the CR# or HCN# of the patient:TF000309:000089><TOG:2><REM2:><REM2:Re-detect new number DNA><VARSR:01><REM2:Reassigns ID to proper VAR- CR to T50, HCN to T40><TVAR2:51:01:%T50%><MACRUN2:ID detection for use in NEW RECORD><MSD:200><IFVAR2:2:34:1:0><OR><IFVAR2:2:34:1:2><MMS2:140,120><LCLK><ELSE><TVAR2:40:01:%T50%><MMS2:250,120><LCLK><ENDIF><REM2:><REM2:Enter new number><MMS2:291,159><LDCLK><TEXTTYPE:%T50%><ACTIVATE2:Search Client><GETCONTROL:06:MED2020 CLINIC.EXE:003:ThunderRT6FormDCSearch ClientThunderRT6FrameThunderRT6CommandButton&Search><CCLICK:T:06:0:T:><ENDIF><ENDIF><ENDREP><IFVAR2:1:93:8:TA><OR><IFVAR2:1:93:8:TB><IFVAR2:2:34:1:0><OR><IFVAR2:2:34:1:2><REM2:Clicks Select on Client Search window><MMS2:550,400><DIS:<TBOX4:T:1:CenterCenter000278000200:000:this did NOT just happen!!!T93=%T93%><LCLK><ENDIF><ELSE><IFVAR2:2:34:1:1><TVAR2:50:01:%T51%><ENDIF><ENDIF><REM2:><REM2:Create a new profile><IFVAR2:1:93:1:A><OR><IFVAR2:1:93:1:B><REM2:Clicks Exit on Client Search window><MMS2:600,400><DIS:<MSTOP><LCLK><MSD:100><VARSR:01><REM2:><REM2:Close empty record><MMS2:140,55><LCLK><MSD:75><MMS2:155,150><CAPCONTROL:F:3:1:000155,000150><REP3:08:000008:000001:0052:0:01:Patient Information><TEXTTYPE:<ESC>><VARGETCONT:1:52><ENDREP><REM2:><REM2:Create the new profile><IFVAR2:1:93:1:B><IVAR2:25:01:1><ACTIVATE2:Misys CPR - Kingston General Hospital PCS><MACRUN2:New PCS><ACTIVATE2:NewClinic><MSD:200><ENDIF><IFVAR2:2:26:2:1><MACRUN2:4-Move CR to new profile + Record><TVAR2:93:01:><VARSR:01><ENDIF><ENDIF><REM2:><REM2:_______________________________________________________________><REM2:Set State to New Record completed so CR reloads after save><IVAR2:95:01:1><REM2:_______________________________________________________________><REM2:Set State to check attributes><IVAR2:25:01:1><REM2:_______________________________________________________________><IFVAR2:2:25:2:1><TVAR2:90:02:FPlease enter date in following format, YYYY-MM-(DD Day optional)TF000205:000258><ENDIF><MMS2:286,177><LDCLK><TEXTTYPE:%T90%><REM2:><REM2:Argument tests to see if "4-Move CR to new profile + Record" (N96=1) has been run.><REM2:If it has been run, then Create Record has two instances running. ><REM2:This will cancel out the ending of one instance.><IFVAR2:2:96:1:1><IVAR2:96:01:0><VARSR:01><MRETURN><ELSE><IFVAR2:2:25:1:1><MACRUN2:6-Open and select Doctor><ENDIF><ENDIF>

Link to comment
Share on other sites

Ok, I am trying Paul's suggestion of using AND.

 

Since they (Does not contain 'A' , Does not contain 'B') are both exclusive condtions, 'AND' does in fact, work here. (Thanks Paul!) I was looking at it from an inclusive viewpoint previously.

 

 

However, I really don't see a reason 'OR' shouldn't work? I'm definitely no computer scientist but this seems pretty elementary.

Link to comment
Share on other sites

Actually it follows boolean or set logic perfectly. If either of the two conditions linked by the OR is true then the overall condition is true. If I have a red car and a blue car and your logic is "car is not red" OR "car is not blue" then it is a true statement that the blue car is not red. Since the first is true and the second is false then the overall condition it true since you have met one of the conditions which is the definition of OR. But your confusion is common and is one of the reasons many systems, for instance file permission logic, preach keeping all the logic on the positive side especially when you compound this a dozen times. In this case if you had a multiple choice red, blue, green, and black then I would make the statement is black OR is green for your condition.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...