Jump to content
Macro Express Forums
Sign in to follow this  
damac3000

logic help

Recommended Posts

here is the code i am using first of all

<IFVAR2:1:78:5:00100><AND><IFVAR2:1:78:6:01996><IFVAR2:1:70:5:2008><ADFBEG:F11:001:000001:000000:X:\Anesthesia stuff\2008 anesthesia crosswalk.txt><IFVAR2:4:01:1:T78><TBOX4:T:1:CenterCenter000278000200:000:asdf%T1% %T2%><TMVAR2:05:02:02:000:000:><BREAK><ENDIF><ADFEND><ENDIF><IFVAR2:1:70:6:2007><ADFBEG:F11:001:000001:000000:X:\Anesthesia stuff\2007 anesthesia crosswalk.txt><IFVAR2:4:01:1:T78><TMVAR2:05:02:02:000:000:><BREAK><ENDIF><ADFEND><ENDIF><IFVAR2:4:01:2:T78><TBOX4:T:1:CenterCenter000278000200:000:ErrorThe CPT that you have entered does not have any anesthestic value. Please make sure you have a valid CPT code and that it is an anesthesia code.><MSTOP><ENDIF><ENDIF><IFVAR2:1:78:5:10000><AND><IFVAR2:1:78:6:69999><TBOX4:T:1:CenterCenter000278000200:000:CrosswalkLookup up the base units according to your cpt code on the Surgery Code Crosswalk

 

Press OK to bring up the crosswalk><LAUNCHDEL2:0:60X:\Anesthesia stuff\2002 Anesthesia Crosswalk.pdf><WFREADY:000010:000000:000000X:\Anesthesia stuff\2002 Anesthesia Crosswalk.pdf><IVAR2:02:02:FEnter the Base Units as per the Anesthesia crosswalk for your CPT

 

FFCenter:Center><IFVAR2:2:02:6:0><TBOX4:T:1:CenterCenter000278000200:000:ErrorThe CPT that you have entered does not have any anesthestic value. Please make sure you have a valid CPT code and that it is an surgery code.><MSTOP><ENDIF><ENDIF>

 

here is what i need to accomplish with this .. i have 2 ranges I am looking for and both of those ranges have a different proces to do ... what i want to do is to an out of range error message that will display an error message when those 2 ranges are not met ... is there a way to do this

Share this post


Link to post
Share on other sites

Your code is a little difficult to follow since there aren't any comments but i think you just need to add an 'Else' to your Ifs. Or perhaps your last IF. I see lines 1-24 are one big IF for cases where T78 is between 00100 and 01996 and a second big IF for 26-37 where T78 is between 10000 and 69999. If you wanted a dancing monkey if T78 wasn't in either of those ranges add an else at 37 and run Dancing Monkey at 38. This will push your last Endif down to 39.

Share this post


Link to post
Share on other sites
Your code is a little difficult to follow since there aren't any comments but i think you just need to add an 'Else' to your Ifs. Or perhaps your last IF. I see lines 1-24 are one big IF for cases where T78 is between 00100 and 01996 and a second big IF for 26-37 where T78 is between 10000 and 69999. If you wanted a dancing monkey if T78 wasn't in either of those ranges add an else at 37 and run Dancing Monkey at 38. This will push your last Endif down to 39.

 

 

i have found what i needed to do .. i need an if statement with an "and" and a "OR" statement in it to get the outside ranges

liek this

<IFVAR2:1:78:3:00100><OR><IFVAR2:1:78:4:01996><AND><IFVAR2:1:78:3:10000><OR><IFVAR2:1:78:4:69999>

Share this post


Link to post
Share on other sites

i do have one more questions regarding if statements or case statements

 

say i have a multiple choice menu that allows users to select multiple items say .. A..B..C...D..E...F

 

now to determine based upon what they select i need to do some math .. if they select more than one i need to do some more math ...would a case satement work if I where to choose a b and c and then have my case statement look like this

 

Case A

do math

end case

 

Case B

add to case A

end case

 

Case C

add to case C

end case

 

will it look for all the variable thought the entire line or do i need to do an if statment for that

Share this post


Link to post
Share on other sites
will it look for all the variable thought the entire line
Not sure I follow. In the simplest form a case statement is just like an If. Often in fact when I see case used it's actually fewer lines to do a series of ifs because it eliminates the switch-endswitch commands. If it doesn't meet the criteria what's within won't get run. Here is a good writeup on the Switch command. It's my understanding that if there is a distinct instruction for each case If works just the same. When Switch becomes more powerful is when combinations of overlapping criteria come into play. EG if you were making a string of text from car specifications and the same thing was done each time one had 8 cylinders it wouldn't batter about the color or manufacturer for which other things can be done. IOW it can simplify more complex matrices that that would become confusing with nested Ifs.

 

So the Else command wasn't working for you? I get the feeling you're making this much more difficult than it needs to be. Why don't you try writing in plain English what you are trying to do and I'd be happy to give my 2 cents.

Share this post


Link to post
Share on other sites

well basically what i origannly needed to do was to what this

 

if t1 >00100

and

t2 < 01999

 

process this text file and lookup the value

 

if t1 >10000

and <69999

 

open up this file

 

 

and then the third option is if it does not meet either of the 2 then display an error message

so i can up with an if/and/or statement

 

if t1<00100

or

t1> 01999

and

t1< 10000

or

>6999

 

then display error message.

 

now if i were to put an else in the 1st one or the 2nd one ... if one of them did not meet the criteria it would display the message

****************

for my case/switch problem.

this is another situation with a multiple coice menu where you can select up to 6 choices

would that be better for a case or an If contain statement to do different calculcations

 

what i want to know is .. say the meny is set to T2 which would contain up to 6 letters from the menu ... ABCDEF

 

if I do a case statment ... will it go thru and look for at least one of the letters like an IF contains B statement would... or do I have to make multiple if statements to do what i want to do

...

the reason why i making this so complicated is to make it easy for the people that I am making this for. This process I am created has a lot of errors with it if it is done manully so I am trying to automate it as much as i can and throw in some validations also

Share this post


Link to post
Share on other sites

But my suggestion still stands and would work perfectly for you.

 

If Range 1

Do thing1

Endif

If Range2

Do thing2

Else

Do thing 3

Endif

 

There is no escape from this. No matter what the case either thing 1, 2, or 3 will be performed. If you look at it closely I think you will realize this satisfies your needs completely and succinctly.

Share this post


Link to post
Share on other sites
But my suggestion still stands and would work perfectly for you.

 

If Range 1

Do thing1

Endif

If Range2

Do thing2

Else

Do thing 3

Endif

 

There is no escape from this. No matter what the case either thing 1, 2, or 3 will be performed. If you look at it closely I think you will realize this satisfies your needs completely and succinctly.

 

I actually tried your suggestion and what happens is if the range 1 if statement is true and does thing 1, then when it comes to range 2 and that is false it will also do the else. I only want it to do the else if neither of the 2 ranges are met. having a third one for the ranges outside of range 1 and range 2 acutally works.

 

*********

regarding the case statements.. it is completely different from the above. i dont think i was explaining myself. I wanted to know if a text variable contains ABCDEF and rather than me using an IF statment I would use a case statment

 

like this

Switch text variable

case A

do thing 1

end case

case B

do thing 2

end case

end switch

i was just wondering if the case statements would read the entire variable and would would run the case statement if it would contain the variable. Like if the text variable contained AB. Would it run both A and B or just A.

Share this post


Link to post
Share on other sites

If statements would work better than Case statements if you are checking for a range. To fine tune Cory's suggestion you could try this:

If Variable %T1% > "00100"
 AND
If Variable %T2% < "01999"
 // Process this text file and lookup the value
Else

 If Variable %T1% > "10000"
AND
 If Variable %T1% < "69999"
// Open up this file
 Else

// Neither condition met, display Error Message
 End If
End If

i was just wondering if the case statements would read the entire variable and would would run the case statement if it would contain the variable. Like if the text variable contained AB. Would it run both A and B or just A.

Case statements will only check for an exact match. You can, however, check for multiple exact matches like this:

Switch (T1)
 Case: A
// Do thing 1
 End Case

 Case: C
// Do thing 2
 End Case

 Case: D
 Case: E
// Do thing 3
 End Case
End Switch

One final caveat. Remember that T variables contain strings. If you are comparing '00100' and '01999' it should work. But, because these are in a string variable, you may find something funny. For example if your variable contains something like '01,000' it will not compare correctly. To accurately compare numeric values you should use integer (%N1%) or decimal (%D1%) variables.

Share this post


Link to post
Share on other sites

Kevin is correct, I made a mistake and should have used an else in the first IF and stuck the second half in there to avoid the situation you pointed out.

Share this post


Link to post
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...
Sign in to follow this  

×
×
  • Create New...