Hot Topic (More than 10 Replies) Programing ? (Read 2218 times)
drgregory
Member
*
Offline


No personal text

Posts: 9
Joined: Jan 17th, 2004
Programing ?
Jan 25th, 2004 at 12:30am
Print Post Print Post  
I am having problems with multiple ORs and ANDs.

This is the code from Q&A:

#11: IF #77="P" THEN STOP;                                                   

IF #10="UN" THEN {#11=#2+18; STOP};                                    
IF #77="AD" THEN {#11=#78+30; STOP};                                 
IF #73="N" AND #10<>"UN" AND #77<>"AD"THEN {#11=#78+120};               
IF #73="Y" AND #65<>"KEEP" AND #10<>"UN" AND #77<>"AD" THEN {#11=#78+120};   
                                                                             
IF #73="Y" AND #10<>"UN" OR "MI" AND #77<>"AD" AND #5>#78+730 THEN      
#11=#78+365;                                                            
                                                                       
IF #73="Y" AND #5 >#78+180 AND #10="MI" AND #77<>"AD" AND #5>#78+730 THEN #11=#78+182;                                                                  
                                                                                                                                               IF #73="Y" AND #5 >#78+180 AND #10<>"UN" AND #77<>"AD" AND #5<#78+730 THEN #11=#78+182;

IF #73="Y" AND #5<#78+180 AND #10<>"UN" THEN #11=" "; 

This is the code from Sesame:

IF CUS="UN" THEN {REVIEW=BKD+18; STOP};
IF SEG="AD" THEN {REVIEW=CLASS+30; STOP};

IF SENT?="N" AND CUS<>"UN" AND SEG<>"AD" THEN {REVIEW=CLASS+120};

IF SENT?="Y" AND HRS<>"KEEP" AND CUS<>"UN" AND SEG<>"AD"
THEN {REVIEW=CLASS+120};

IF SENT?="Y" AND CUS<>"UN" OR "MI" AND SEG<>"AD" AND EOS>(CLASS+730)

THEN {REVIEW=CLASS+365};

IF SENT?="Y" AND EOS>CLASS+180 AND CUS="MI" AND SEG<>"AD" AND

EOS>CLASS+730 THEN {REVIEW=CLASS+182};

IF SENT?="Y" AND EOS >CLASS+180 AND EOS<CLASS+730 THEN

{REVIEW=CLASS+182};

IF SENT?="Y" AND EOS <CLASS+180 THEN REVIEW=" ";


My problem is that multiple ORs and ANDs do not seem to work in Sesame.  I get an error string for the AND between "AD" AND "EOS" in this line:

IF SENT?="Y" AND CUS<>"UN" OR "MI" AND SEG<>"AD" AND EOS>(CLASS+730) THEN {REVIEW=CLASS+365};

Does Sesame not allow this and if not how can I get around it with different code that does the same thing?  The same question would apply to OR which I am having the same problem with.
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programing ?
Reply #1 - Jan 25th, 2004 at 5:45am
Print Post Print Post  
Quote:
My problem is that multiple ORs and ANDs do not seem to work in Sesame.  I get an error string for the AND between "AD" AND "EOS" in this line:

IF SENT?="Y" AND CUS<>"UN" OR "MI" AND SEG<>"AD" AND EOS>(CLASS+730) THEN {REVIEW=CLASS+365};



I believe multiple ORs and AND should work in Sesame. You might have to group it when required using bracket.
It seems like there is a faulty syntax in your code at one place

It should be:

IF SENT? = "Y" AND (CUS <> "UN" OR CUS <> "MI" ) AND SEG <>" AD" AND EOS > (CLASS + 730) THEN

       {
               REVIEW = CLASS + 365
        }

Please let us know if it works.

Also there has been some bug with STOP command, try some other method to terminate such as goto or cnext.  I had to modify code in one application to remove STOP as it caused stack overflow errors. 
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programing ?
Reply #2 - Jan 25th, 2004 at 2:52pm
Print Post Print Post  
The STOP command and the GOTO command may cause errors when used in the GLOBAL CODE section. In ordinary code, STOP should be okay. Check with the "workarounds" page - its the last item on it:

http://www.lantica.com/Support/sesame_workarounds.html

Though I would like to point out that code that uses STOP or GOTO is typically harder to maintain (fix) than code that uses loops or conditionals to achieve the same result.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programing ?
Reply #3 - Jan 25th, 2004 at 3:25pm
Print Post Print Post  
Mark, thanks for clarifying the issue with STOP command. In the bug report, what does "Status: Pending" mean? Would it be fixed in the upcoming version or not?
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Programing ?
Reply #4 - Jan 25th, 2004 at 3:39pm
Print Post Print Post  
Status "pending" means that we intend to fix it, but it has not yet been fixed in the upcoming release.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
drgregory
Member
*
Offline


No personal text

Posts: 9
Joined: Jan 17th, 2004
Re: Programing ?
Reply #5 - Jan 25th, 2004 at 4:48pm
Print Post Print Post  
The bracketed group did get me by the error string.  I have been unable to work the form due to one more error.  I have attempted to bracket different groupings but to no avail.  Thanks for the help. 

This is the code for may last problem:

IF VIC="" then VIC ="UNK";
IF DV="YES" OR "Y" AND VIC <> "UNK" AND VIC
<> "DONE" AND VIC <> "NO" THEN VIC="NEED"
                             
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programing ?
Reply #6 - Jan 25th, 2004 at 5:20pm
Print Post Print Post  
Quote:
IF VIC="" then VIC ="UNK"; 
IF DV="YES" OR "Y" AND VIC <> "UNK" AND VIC 
<> "DONE" AND VIC <> "NO" THEN VIC="NEED"



The same kind of error in syntax again. It is just not the bracket but also syntax:

Please note:

You have   
If DV = "Yes" or "Y"

It should be
If DV = "Yes" or DV = "Y"

So the final code should be:

IF VIC="" then VIC ="UNK"; 
IF (DV="YES" OR  DV = "Y") AND VIC <> "UNK" AND VIC 
<> "DONE" AND VIC <> "NO" THEN VIC="NEED"


Please let us know if it works.
  
Back to top
 
IP Logged
 
drgregory
Member
*
Offline


No personal text

Posts: 9
Joined: Jan 17th, 2004
Re: Programing ?
Reply #7 - Jan 25th, 2004 at 9:21pm
Print Post Print Post  
OK, now I understand about the syntax.  Thanks for the clues.  I still have some clean up to do. The majority of our database is based on one form.  Many people access it and do different tasks.  I have restrictions set up on some of the elements.  The first few users do not access these elements but are getting errors due to no entry.  Is it possible to allow for blank entries in the restrictions?
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Programing ?
Reply #8 - Jan 25th, 2004 at 10:06pm
Print Post Print Post  
Quote:
I have restrictions set up on some of the elements.  The first few users do not access these elements but are getting errors due to no entry.  Is it possible to allow for blank entries in the restrictions?


I am not quite sure if I understood what exactly you are doing.  But it seems like you have a few elements in the Form in which you have put restriction that they cannot be blank.  You must have placed "!"  in the restriction.  If that is the case, just remove that symbol from restriction.

It could be that you have placed restriction in an element that its entry can be just Father, Mother, Brother and Sister only and nothing else.   This you do it by placing  

Father; Mother; Brother; Sister;

in the restriction. If you also want it to accept blank entry just enter " =  ". The new restriction entry will look like this:

Father; Mother; Brother; Sister; =  ;

Sesame offers choice of Mandatory Restriction and Optional Restriction. With Optional Restriction one can override and still save the record.

On the top of all these, Sesame also gives you choice of NotifyForm ( ) command in the programming for the purpose of not saving the record without proper entry.  

Please clarify if that is what you are looking for or something else.
  
Back to top
 
IP Logged
 
drgregory
Member
*
Offline


No personal text

Posts: 9
Joined: Jan 17th, 2004
Re: Programing ?
Reply #9 - Jan 26th, 2004 at 2:23am
Print Post Print Post  
Again,  Thank you for all the help.  I want to restrict what goes in the element, such as Father, Mother, Sister, but yet allow a blank if that user does not access that element of the form.
You have given me the answer with "=".
  
Back to top
 
IP Logged
 
GW
Junior Member
**
Offline


No personal text

Posts: 83
Joined: Dec 16th, 2003
Re: Programing ?
Reply #10 - Jan 26th, 2004 at 2:22pm
Print Post Print Post  
I'm having a small problem with programming in subforms.
On the main form the @FormResultSetTotal progamming in the "SubTotal" element works fine but a simple mathematical operator of Amount = Price * Qty0 in "on element exit" of "Price" in the SubForm has given mixed results.
Never seems to work in the first line item and appears to be spasmodic of when it  works at all in the other line items.
Any suggestions of what I'm missing  ???
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Programing ?
Reply #11 - Jan 26th, 2004 at 2:43pm
Print Post Print Post  
Becky

Misery loves company. I am embarrassed to admit I am  almost happy to hear you are having this problem.  Embarrassed

I have been having the same results. I figured It was something I had messed up with other programming. Sometimes it seemed to work correctly other times does not work.

Now that I realize I might not be imagining this I will play more with it and see if I can get repeatable results that we can compare notes with. .
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
GW
Junior Member
**
Offline


No personal text

Posts: 83
Joined: Dec 16th, 2003
Re: Programing ?
Reply #12 - Jan 26th, 2004 at 2:51pm
Print Post Print Post  
Thanks Bob, you made me feel a whole lot better  Grin
I was almost too embarrassed to even post that one, have been tearing the form apart and and rebuilding to get this one working to no avail.
Lets face it, this is 1.01 isn't it  Grin
  
Back to top
 
IP Logged