Normal Topic Combining two XListValues fields (Read 953 times)
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Combining two XListValues fields
Dec 21st, 2005 at 4:11pm
Print Post Print Post  
I am trying to combine two external fields to pop up on the same line so that the user can choose the appropriate vendor where their are similar vendors but different references.

For example: Supplier A with a reference of RRSP.  The same Supplier A with a reference of Group Benefits.  Same supplier but different vendor #'s.

I have currently have a combo box that populates with the following programming:

var vList as String


vList = @XListValues("VENDORS.DB", "VENDORS!VENDOR NAME") + @XListValues("VENDORS.DB", "VENDORS!REFERENCE")
vList = @SortStringArray(vList, 0)                  //0 = ASCII sort, 1 = Number sort
PopulateListElement(vENDOR NAME, vList)


Unfortunately, it lists all the available Vendor Names and all the available references in alpha order instead of:

Supplier A - RRSP
Supplier A - Group Benefits

Is their a way to do this ? I tried to modify the statements but with no luck.

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Combining two XListValues fields
Reply #1 - Dec 21st, 2005 at 4:18pm
Print Post Print Post  
Hello Louis,

You will want to use @XLookupSourceListAll() as it can return two values from the same record at the same time, instead of @XListValues which can only return one value from each record.

Try the code below. Note this is untested as I do not have your app, but it should be close.

Code
Select All
var vList as String


vList = @XLookupSourceListAll("VENDORS.DB", "..", "VENDORS!VENDOR NAME", "VENDOR NAME;REFERENCE")
vList = @Replace(vList, ";", " - ")
vList = @Replace(vList, @Newline(), ";")
vList = @SortStringArray(vList, 0)    //0 = ASCII sort, 1 = Number sort
PopulateListElement(vENDOR NAME, vList)   



Happy Holidays
Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Combining two XListValues fields
Reply #2 - Dec 21st, 2005 at 5:18pm
Print Post Print Post  
Ray:

It works but it returns both the vendor name and reference.    The reference is only required for selection purposes.

I am sure you have more ideas.

Thanks,

Louis

  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Combining two XListValues fields
Reply #3 - Dec 21st, 2005 at 5:29pm
Print Post Print Post  
Hello Louis,

If the reference is only required for selection purposes then you will need to use the string manipulation commands to strip the reference away from the selected value. @Left() and @Instr() will probably get you what you want.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Combining two XListValues fields
Reply #4 - Dec 21st, 2005 at 6:28pm
Print Post Print Post  
Ray:

I am having a heck of a time with the programming.

My programming now reads:

var vList as String
 
 
vList = @XLookupSourceListAll("VENDORS.DB", "..", "VENDORS!VENDOR NAME", "VENDOR NAME;REFERENCE")
vList = @Replace(vList, ";", " - ")                        // replaces ;separated values with a " -  "
vList = @Replace(vList, @Newline(), ";")                  // inserts newline in list
vList = @SortStringArray(vList, 0)                        //0 = ASCII sort, 1 = Number sort   
PopulateListElement(VENDOR NAME, vList)   
Vendor Name = @LEFT(vList, @INSTR(vList, ";") -1)

Unfortunately, it is still returning the entire value including the dash and it is really everything before the dash.  I have tried inserting the dash in lieu of the ; but to no avail.

Any suggestions before lunch ?

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Combining two XListValues fields
Reply #5 - Dec 21st, 2005 at 8:32pm
Print Post Print Post  
You are going to need to strip the "- Reference" away after the field has been set, Not when the combo box is being populated. The on Element Change event should work for you.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Combining two XListValues fields
Reply #6 - Dec 22nd, 2005 at 9:10pm
Print Post Print Post  
Ray:

How do I strip this away ? 

It is no longer a semi-colon separated string and  @Left needs a value to determine where to end.

I have tried the INSTR as well but with no luck.

Any hints ?

Thanks,

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Louis Galvao
Full Member
***
Offline


"Sufferin' Succatash"

Posts: 265
Location: Canada
Joined: Feb 14th, 2005
Re: Combining two XListValues fields
Reply #7 - Dec 28th, 2005 at 4:13pm
Print Post Print Post  
Help !  Is there anyone out there ?

Louis
  

Louis Galvao
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Combining two XListValues fields
Reply #8 - Dec 28th, 2005 at 4:27pm
Print Post Print Post  
Hello Louis,

You would use @InStr on ' - ', without the quotes, and you would want the value to the left of the ' - '. Do this in the On Element Change Event.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged