Normal Topic Question about @LEFT (Read 739 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Question about @LEFT
Sep 6th, 2006 at 2:33pm
Print Post Print Post  
I have a field on my Invoice form (currently called F0076) which holds the string "PAID IN FULL, (#ofdays)" where #ofdays is calculated based on the date of the last payment against the date of the invoice.  The calculations of the age can occur in (currently) six different places (I have fields for the posting of 6 payments against the invoice - this will expand now that the database has moved to Sesame).

Current Q&A programming performs this string generation every time a record is opened, which is not necessary if it's already happened before.  I'd like to change it so that it only occurs if 2 conditions exist:
1) the balance due is 0 and
2) the field doesn't already contain the PAID IN FULL string

Would this do what I want?
Code
Select All
IF (BALANCE_DUE = 0 AND NOT @LEFT(F0076, 12) = "PAID IN FULL")
THEN ... 



I'm hesitant to change my code just to test it because this would be an on-form-entry event in update mode and I don't want to chump my current data, which is correct and unchanged since the Q&A translation.
  

**
Captain Infinity
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Question about @LEFT
Reply #1 - Sep 6th, 2006 at 3:21pm
Print Post Print Post  
Quote:
I'm hesitant to change my code just to test it because this would be an on-form-entry event in update mode and I don't want to chump my current data, which is correct and unchanged since the Q&A translation.


Please work on a backup. Then when you know that you won't "chump" your original data, apply the backup (reconcile) to a copy of your .db and .dat.
  

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


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Question about @LEFT
Reply #2 - Sep 6th, 2006 at 4:13pm
Print Post Print Post  
You can also comment out the original "good" Q&A code.
Copy it to area to be tested, modify as needed.
Then removed commented original code when new code is proven.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Re: Question about @LEFT
Reply #3 - Sep 6th, 2006 at 7:48pm
Print Post Print Post  
Thanks guys, I followed your advice and got it to work....I think.  Still not sure but so far so good.  I was uncertain if I could use @LEFT in a conditional, because the book just shows it as a value assigner.  If that makes sense.  I also had some trouble with case sensitivity.  But I think I got it licked.

And, actually, the whole experience has motivated me to split out the descriptor string from the number of days (a text field and a number field) because then I can do math on the number.
  

**
Captain Infinity
Back to top
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Question about @LEFT
Reply #4 - Sep 6th, 2006 at 8:26pm
Print Post Print Post  
Infinity,

For future reference:
SBasic is not case sensitive and @Left can be used inside of a conditional statement.

-Ben
  
Back to top
IP Logged