Normal Topic Wrapping @XLookupSourceList (Read 1362 times)
Infinity
Senior Member
Members
*****
Offline


Diagonally parked in a
parallel dimension

Posts: 1290
Location: Massachusetts
Joined: May 27th, 2005
Wrapping @XLookupSourceList
Oct 19th, 2006 at 6:33pm
Print Post Print Post  
Here's a line of code I'm currently using:
Code
Select All
vInfo = @XLookupSourceList(@FN, Bill_To_Code, "CUSTOMER!CODE", "Company;Address;Contact;City;State;Zip_Code;Phone_Area_Code;Phone_Exchange;Phone_Extension;Discount") 


This works but as you can see it's a very long line.  My planned lookups for my Workorder details will include even more elements.  I hear the Sesame V2 Program Editor will have scrollbars and that will help, but right now long lines like this are tasking.

What's the best way to write this in the program editor so that it wraps on my screen so I can see it all and still functions?  That is, where should I introduce line breaks, and what would the additional lines require to tell Sesame that it's a continuation of the lines above it?
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wrapping @XLookupSourceList
Reply #1 - Oct 19th, 2006 at 6:35pm
Print Post Print Post  
Try something like this:

Code
Select All
var vList as String
var vInfo as String

    vList = "Company;Address;Contact;City;State;Zip_Code;Phone_Area_Code;Phone_Exchange;Phone_Extension;Discount"
    vInfo = @XLookupSourceList(@FN, Bill_To_Code, "CUSTOMER!CODE", vList)
 



Or

Code
Select All
var vList as String
var vInfo as String

    vList = "Company;Address;Contact;City;State;Zip_Code;"
    vList = vList + "Phone_Area_Code;Phone_Exchange;Phone_Extension;Discount"
    vInfo = @XLookupSourceList(@FN, Bill_To_Code, "CUSTOMER!CODE", vList)
 

  

- Hammer
The plural of anecdote is not data.
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: Wrapping @XLookupSourceList
Reply #2 - Oct 19th, 2006 at 6:48pm
Print Post Print Post  
Thank you.  I'm still trying to get into the habit of using variables; they're clearly very useful.
  

**
Captain Infinity
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: Wrapping @XLookupSourceList
Reply #3 - Oct 19th, 2006 at 6:57pm
Print Post Print Post  
This has got me to thinking.  I could use vList in several other places in my program(saving me lots of code) so maybe it's better saved as a Global Static variable?  Or a Global Value?
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wrapping @XLookupSourceList
Reply #4 - Oct 19th, 2006 at 7:09pm
Print Post Print Post  
Infinity wrote on Oct 19th, 2006 at 6:57pm:
This has got me to thinking.  I could use vList in several other places in my program(saving me lots of code) so maybe it's better saved as a Global Static variable?  Or a Global Value?



If you are using it elsewhere on the same Form, then use a stat declared in GLOBAL CODE. If you are using it on multiple Forms or Reports, use a GlobalValue.
  

- Hammer
The plural of anecdote is not data.
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: Wrapping @XLookupSourceList
Reply #5 - Oct 19th, 2006 at 7:25pm
Print Post Print Post  
It will be just this form.  The following Global Code breaks everything; what am I missing?
Code
Select All
Stat sCustInfoList as String


sCustInfoList = "Company;Address;Contact;City;State;Zip_Code;Phone_Area_Code;"
sCustInfoList = sCustInfoList + "Phone_Exchange;Phone_Extension;Discount"


/*
Returns an Int indicating the number of
days between vDate1 and vDate2
*/

FUNCTION DaysBetweenDates(vDate1 as Date, vDate2 as Date) As Int
var vRet as Int
var vD1 as Int
var vD2 as Int

	vD1 = @ToNumber(vDate1)
	vD2 = @ToNumber(vDate2)
	vRet = vD2 - vD1
	Return(vRet)

END FUNCTION


// Calculates the total of all payments

Subroutine CalculateTotalPayments()
PAYMENTS_TOTAL=(Payment_1_Amt+Payment_2_Amt+Payment_3_Amt+Payment_4_Amt+Payment_5_Amt+Payment_6_Amt)
End Subroutine


// Clears all customer info

Subroutine ClearCustInfo()
CLEAR(Company,Address,Contact,City,State,Zip_Code,Phone_Area_Code)
CLEAR(Phone_Exchange,Phone_Extension,Details_Customer_Discount_Percentage)
End Subroutine 



Thanks for your help, Erika.
  

**
Captain Infinity
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Wrapping @XLookupSourceList
Reply #6 - Oct 19th, 2006 at 7:33pm
Print Post Print Post  
Well, I may need a more specific definition of "breaks everything" but start by moving the two lines where you set sCustInfoList down under everything else. Executable lines must come after all the variable declarations and procedure (function and subroutine) definitions.
  

- Hammer
The plural of anecdote is not data.
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: Wrapping @XLookupSourceList
Reply #7 - Oct 19th, 2006 at 7:40pm
Print Post Print Post  
By "breaks everything" I mean I get the dreaded "This program has generated too many errors" message.  But your solution makes the editor HAPPY!  HAPPY!  YAY!!

I did not know about executable lines after vars/functions/subroutines.  Haven't tested it yet on a reconciled db but I think I'm on the right track.  Thanks again for your help.
  

**
Captain Infinity
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: Wrapping @XLookupSourceList
Reply #8 - Oct 19th, 2006 at 7:51pm
Print Post Print Post  
I think that this is even easier to read:

sCustInfoList = "Company;Address;Contact;City;State;Zip_Code;Phone_Area_Code;"
sCustInfoList += "Phone_Exchange;Phone_Extension;Discount"
  



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: Wrapping @XLookupSourceList
Reply #9 - Oct 19th, 2006 at 7:56pm
Print Post Print Post  
Ooooo, shiny!    Shocked

Thanks Bob!
  

**
Captain Infinity
Back to top
IP Logged