Very Hot Topic (More than 25 Replies) UserSelect Question (Read 12529 times)
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
UserSelect Question
Mar 18th, 2005 at 9:16pm
Print Post Print Post  
Im looking to add a XUserSlect to a layout  "dispatch" looking up the customers name from the "customer" layout. my question is my customer select field is HUGE, is there a way to type the first few letters of the customers name in the primary field to reduce the size of the user select field?


I kinda feel like the boy who found a genie in a bottle, Im afraid to waste any of my three wishes on stupid questions.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: UserSelect Question
Reply #1 - Mar 18th, 2005 at 9:25pm
Print Post Print Post  
Hello,

Here is an example that should be able to get you started in the right direction.

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=program;action=display;...

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
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: UserSelect Question
Reply #2 - Mar 18th, 2005 at 9:27pm
Print Post Print Post  
Yes, it can be done easily using xuserselectr function. There was quite a discussion about it on this forum. I will look up the thread and post it here. I use this all quite extensively.
  
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: UserSelect Question
Reply #3 - Mar 18th, 2005 at 10:04pm
Print Post Print Post  
It is discussed in following thread.

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=archived;action=display...

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=archived;action=display...

As Ray pointed out,  the function provided by Erika that is also placed in the programming example section is used for this function. By using that function we can use the most common search carteria that is being used in Sesame and Q&A.

Use of above function with @xuserselectr

John..  will give you the list of items starting with John
..John.. will give you list of items with "John" somewhere 
..John  will give you list of items ending with "John"
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #4 - Mar 20th, 2005 at 4:50am
Print Post Print Post  
I think this is WAY over my head at the present time. thank you for the direction.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #5 - Mar 20th, 2005 at 10:20pm
Print Post Print Post  
After reading this post over and over, heres what I have
oName is the element on the order form vName is the element on the Vendors form
I have this in element (on exit)

if @in(oName, "..") > 0 then 

{
  vFieldName = oName
  picklist_choose ( )
   
  oName = @xUserselectR ("newdispatch.db”, "Vendors!Vname", "VName", vStart, vEnd)

}

and this in global code

stat vFieldName as String
stat vStart as String
stat vEnd as String

Subroutine PickList_choose( )

vStart = @left (vFieldName, @in (vFieldName, "..") - 1) + @chr (1)
vEnd = @left (vFieldName,   @in (vFieldName, "..") - 1) + "zzzzzzz"
End Subroutine

When tabbed or entered it does nothing…..
Where did I mess up, I checked spelling also
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #6 - Mar 20th, 2005 at 10:35pm
Print Post Print Post  
Probably you already know that x-family of commands and functions cannot be tested in the Preview mode. You are better of saving your application appended by test or reconciling it first. I prefer the first method. If it is Customer.dsr, I save the application as Customertest.db.  When everything works as you want, you may reconcile it to customer.db

See if this helps.
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #7 - Mar 21st, 2005 at 12:17am
Print Post Print Post  
yep, that thing about the x family not working in preview  had my head on fire last week. I have come a long way with the help of this forum. I have tested it in  a reconsiled file.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #8 - Mar 21st, 2005 at 12:27am
Print Post Print Post  
oh my it works!!! I been working on it to long, I was forgeting to put the dot dot on the end of it! your good! thank you so very much for the help!
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #9 - Mar 21st, 2005 at 5:55pm
Print Post Print Post  
".." is not just for what to search but also when to search. I usually use this for find out the code. When you already know the code, you don't have have to have the list, select the item from the list and waste time. I have also found it useful to make one display element in external database from where you are looking up the value and produce the display of information in the the list as I wish to see it. Moreover this will help to deal with the "/" character that is not that user friendly as it serves as menu like function.
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #10 - Mar 21st, 2005 at 6:10pm
Print Post Print Post  
I found that out about if you know the code it doesnt waste time on the pick list. Only thing is when I type " ..abc.." it pulls up the whole list "abc.." works nice and "..abc" seems to work. but im not complaining, im too happy about getting past this first hurdle. thanks for the time and all the help!
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #11 - Mar 21st, 2005 at 6:54pm
Print Post Print Post  
..abc..should pull out only the list which containg "abc" string somewhere in the item.  Have you used the function that Erika provided and place it in the Global Code before placing the subroutine pick list () ?
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #12 - Mar 21st, 2005 at 7:45pm
Print Post Print Post  
no, i did not. and when I did (put it in global) it made an error on evevry xlookup and all other functions in program. strange
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #13 - Mar 21st, 2005 at 8:02pm
Print Post Print Post  
Give me little time, I will place here the code I am using.
  
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: UserSelect Question
Reply #14 - Mar 21st, 2005 at 8:42pm
Print Post Print Post  
I have implemented abc..  and ..abc..
I do not see any value of ..abc if both above are working.

Global Code
______________

var vFieldName as String
var vStart as String
var vEnd as String


// Finds all values in vVals that contain vMatch. Returns matching
// values as a semicolon separated list.
Function FilterValueList(var vVals as String, vMatch as String) as String
var vList as String
var vItem as String

vList = ""
While @Len(vVals) > 0
{
  vItem = Split(vVals, ";")
  If @Instr(vItem, vMatch) > 0
  {
   If @Len(vList) > 0 
   {
    vList = vList + ";"
   }
   vList = vList + vItem
  }
}
return(vList)
End Function


var vApplication as String
var vTarget as String
var vDisplay as string

//For PickList

Subroutine PickList_choose( )
var vVals as String
var vFinalList as String
var vSearch as String

If @Right (vfieldName, 2) = ".." and @Left (vFieldName, 2) <> ".." then
     {
     
           vStart = @left (vFieldName, @in (vFieldName, "..") - 1) + @chr (1)
           vEnd = @left (vFieldName,   @in (vFieldName, "..") - 1) + "zzzzzzz"

     }

If @left (@(vFieldName), 2) = ".." and @Right (@(vFieldName), 2) = ".." then
     {
           vSearch = @replace (@(vFieldName), "..", "")
           vFinalList = ""
           vVals = @XListValues(vApplication, vDisplay) 
           vFinalList = FilterValueList(vVals, vSearch)
           @(vFieldName) = @UserSelect(vFinalList)
        
         If @in (@(vFieldName), "/") > 0 then
           @(vFieldName) = @Replace (@(vFieldName), "/", "//")
           //writeln (@(vFieldName))                  
           
           @(vFieldName) = @xlookup (vApplication, @(vFieldName), "Display1", vTarget)

     }

End Subroutine

======================

Dx1  on element exit event    (Dx1 is the name of element)
____________

If @left (Dx1, 2) = ".." and @right (Dx1, 2) = ".." then

     {
           vApplication = "data\diag.db"
           vTarget = "DiagCode"
           vDisplay = "Diag!Display1"
           vFieldName = "Dx1"
           picklist_choose ( )
           
     }

if @Right (Dx1, 2) = ".." and @Left (Dx1, 2) <> ".." then

     {
           vFieldName = Dx1
           picklist_choose ( )
           
           Dx1 = @xUserselectR ("data\Diag.db", "Diag!Display", "DiagCode", vStart, vEnd)
     }
  
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: UserSelect Question
Reply #15 - Mar 21st, 2005 at 9:30pm
Print Post Print Post  
The code that has been placed in the Global Code, can be placed in the element itself but then you will not be able to use Pick list ( ) subroutine and Filter function with other elements. I have to use the function and subroutine in many elements of the form, so I have put them in the Global Code.

  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #16 - Mar 21st, 2005 at 10:15pm
Print Post Print Post  
that works very nice, ..abc.. pulls up the pick list but when I select the item it does not put it in the vFieldName. abc.. works normally. need to recheck my spelling
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #17 - Mar 21st, 2005 at 10:49pm
Print Post Print Post  
@(vFieldName) = @UserSelect(vFinalList)  //This one pick up the display value

   
     If @in (@(vFieldName), "/") > 0 then
  @(vFieldName) = @Replace (@(vFieldName), "/", "//")
  //writeln (@(vFieldName))

/*  I had to place above because I have "/" in the data like 10mg/1ml and this thing mess up the routine */   
   
  @(vFieldName) = @xlookup (vApplication, @(vFieldName), "Display1", vTarget)

/* The above use display value as key value and xlookup to get code that you want to have */

}
  
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: UserSelect Question
Reply #18 - Mar 21st, 2005 at 11:11pm
Print Post Print Post  
Dx1  on element exit event    (Dx1 is the name of element)
____________

If @left (Dx1, 2) = ".." and @right (Dx1, 2) = ".." then

{
  vApplication = "data\diag.db"
  vTarget = "DiagCode"
  vDisplay = "Diag!Display1"
  -->vFieldName = "Dx1"
  picklist_choose ( )
   
}

if @Right (Dx1, 2) = ".." and @Left (Dx1, 2) <> ".." then 

{
  -->vFieldName = Dx1
  picklist_choose ( )
   
  Dx1 = @xUserselectR ("data\Diag.db", "Diag!Display", "DiagCode", vStart, vEnd)
}

=======================

Please note in the above part of the code which is marked by red arrow:

The code at the first red marker takes the name of the element as the value and use it as a indirect reference,  while the code marked by second red arrow refers to the value of the element. I thought not putting or putting quotes might make that difference.

  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #19 - Mar 22nd, 2005 at 12:17am
Print Post Print Post  
yep, thats what i have heres mine

If @left (company name, 2) = ".." and @right (company name, 2) = ".." then

{
  vApplication = "data\newdispatch.db"
  vTarget = "cust_name"
  vDisplay = "cust!cust_name"
  vFieldName = "company name"
  picklist_choose ( )


}

if @Right (company name, 2) = ".." and @Left (company name, 2) <> ".." then 

{
  vFieldName = company name
  picklist_choose ( )
   
  company name = @xUserselectR ("data\newdispatch.db", "cust!cust_name", "cust_name", vStart, vEnd)
}
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #20 - Mar 22nd, 2005 at 12:28am
Print Post Print Post  
case I messed up here is my global code

var vFieldName as String
var vStart as String
var vEnd as String


// Finds all values in vVals that contain vMatch. Returns matching 
// values as a semicolon separated list. 
Function FilterValueList(var vVals as String, vMatch as String) as String 
var vList as String 
var vItem as String 

vList = "" 
While @Len(vVals) > 0 

  vItem = Split(vVals, ";") 
  If @Instr(vItem, vMatch) > 0 
  { 
   If @Len(vList) > 0 
   { 
    vList = vList + ";" 
   } 
   vList = vList + vItem 
  } 

return(vList) 
End Function


var vApplication as String
var vTarget as String
var vDisplay as string

//For PickList

Subroutine PickList_choose( )
var vVals as String 
var vFinalList as String 
var vSearch as String 

If @Right (vfieldName, 2) = ".." and @Left (vFieldName, 2) <> ".." then
{

  vStart = @left (vFieldName, @in (vFieldName, "..") - 1) + @chr (1)
  vEnd = @left (vFieldName,   @in (vFieldName, "..") - 1) + "zzzzzzz"

}

If @left (@(vFieldName), 2) = ".." and @Right (@(vFieldName), 2) = ".." then
{
  vSearch = @replace (@(vFieldName), "..", "") 
   vFinalList = "" 
   vVals = @XListValues(vApplication, vDisplay) 
   vFinalList = FilterValueList(vVals, vSearch) 
   @(vFieldName) = @UserSelect(vFinalList)
    
     If @in (@(vFieldName), "/") > 0 then
  @(vFieldName) = @Replace (@(vFieldName), "/", "//")
  //writeln (@(vFieldName))   
   
  @(vFieldName) = @xlookup (vApplication, @(vFieldName), "Display1", vTarget)

}

End Subroutine
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #21 - Mar 22nd, 2005 at 1:12am
Print Post Print Post  
@(vFieldName) = @xlookup (vApplication, @(vFieldName), "Display1", vTarget)


In the above part of code you have to replace "Display1" with your field which would be "cust!cust_name"

So, your line of code will be

@(vFieldName) = @xlookup (vApplication, @(vFieldName), "cust!cust_name", vTarget)

I believe this should work for you.
  
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: UserSelect Question
Reply #22 - Mar 22nd, 2005 at 1:24am
Print Post Print Post  
Looking at your code, it seems like you are displaying a list of Customers after putting ..abc.. value in Company Name element and after selecting selecting a customer name, you want to place that in Customer Name element. Is that correct?
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #23 - Mar 22nd, 2005 at 1:30am
Print Post Print Post  
yes. and thank you very much for your time with me on this
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #24 - Mar 22nd, 2005 at 2:02am
Print Post Print Post  
I also have this same thing on another form that looks up vendors. I plan on using this on parts lookups and inventory, I see endless opportunity&#8217;s. All is good
looks like I owe you an airplane ride! thats about the only thing im good at
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: UserSelect Question
Reply #25 - Mar 22nd, 2005 at 2:02pm
Print Post Print Post  
Quote:
I also have this same thing on another form that looks up vendors. I plan on using this on parts lookups and inventory, I see endless opportunity's. All is good
looks like I owe you an airplane ride! thats about the only thing im good at

You're good at airplane rides? Sounds interesting! Tell us!!!  Cheesy
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #26 - Mar 24th, 2005 at 3:27am
Print Post Print Post  
hahaha, no nothing as interesting or glorious as a jet jockey more like a taxi with wings. Still the worst day flying is better than the best day working.
p.s. the code works very good
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #27 - Mar 27th, 2005 at 2:47am
Print Post Print Post  
On a new and different project, Im looking to use a  userselect on a dispatch form that uses the customers name to get an equipment type from the customers subform named equipment list. Is that possible? does anyone have an example?
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #28 - Mar 27th, 2005 at 3:04am
Print Post Print Post  
Quote:
Im looking to use a  userselect on a dispatch form that uses the customers name to get an equipment type from the customers subform named equipment list.


As I understand you want to have list from Subform. Which form has the key value, Parent or subform?
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #29 - Mar 27th, 2005 at 4:12am
Print Post Print Post  
thank you Bharat,  the parent form has the key. looking for a userselect list for all the equipment on its subform. it would be a short list.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #30 - Mar 27th, 2005 at 4:30am
Print Post Print Post  
You are trying to get the list from subform and ParentForm has the key. You will have to get info in the subform. For that you will have to make one more element that takes the key value from the parentform, hide that element, so it does not take the realestate of the subform.

Intially you can mass update but later on for new as well as updated form, it should automatically take the key value into the subform.

Once you have the key value in subform, the rest should be easy.
  
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: UserSelect Question
Reply #31 - Mar 27th, 2005 at 7:37am
Print Post Print Post  
Does your subform has Natural link or relational link?
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #32 - Mar 27th, 2005 at 6:14pm
Print Post Print Post  
had to look that one up, Its natural linking.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #33 - Mar 27th, 2005 at 6:58pm
Print Post Print Post  
That should be ok. I was thinking about the mass-updating the data in the subform.  If it was relational link, you will have already key field in place. Since you have natural link, you will have to make a field and mass update if link is not already in place.
  
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: UserSelect Question
Reply #34 - Mar 28th, 2005 at 4:36am
Print Post Print Post  
I have done some work in sample database, Countries, that is a typical database with subform named "Cities". I created on element in subform named "Country"  and updated its value from ParentForm "Countries".  I used following Code for Mass Updating

Code
Select All
var vName as String
var i as Int


For i = 1 to @FormResultSetTotal("Cities")
	FormFieldValue ("Cities", "Country", i, @FormFieldValue("Countries", "Country", @FormResultSetCurrentPosition("Countries")))

Next


 



It produced the desired result. Now subform have "Country" element which proper country.

I made one other form named Display, which has just two elements namely - Country and City.

I can get the x-family work on the parent form, say getting the name of the Country from the parent form, but using the x-family commands on subform elements and layouts failed miserably. The following command in Display layout did not yield anything...

Code
Select All
vString2 = @xlookupall (@FN, Country, "Cities!Country", "City")
writeln (vstring2)


PopulateListElement( City, vString2)
 




or

Code
Select All
var vString2 as String



vString2 = @XLookupSourceList(@FN, Country, "Cities!Country", "City")

PopulateListElement( City, vString2)

 



Attempt is to narrow down the list of the cities having already key is being established in subform. I have not been successful so far.  That leads me to ask, do these commands (x-family) works to get the data from subform, or it needs to have the form at the same level?
  
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: UserSelect Question
Reply #35 - Mar 28th, 2005 at 4:05pm
Print Post Print Post  
Never mind. Above works perfect.
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #36 - Mar 28th, 2005 at 6:43pm
Print Post Print Post  
I have this programed in (ON ELEMENT EXIT)  on what I have as the  DISPATCH form or your display form.

var vString2 as String



vString2 = @XLookupSourceList(@FN, Company name, "equipment list!co_name", "Equipment type")

PopulateListElement( machine type, vString2)

with no errors but aslo with no results. I did a manual update on the equipment list as its so small at the moment
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #37 - Mar 28th, 2005 at 7:43pm
Print Post Print Post  
FlipGilbert,
Please send me your e-mail address so I can send you the sample application countries1.db (modified countries.db which comes as a sample application with Sesame).  I guess this will make understanding clear about how it works.

Bharat
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #38 - Mar 28th, 2005 at 8:24pm
Print Post Print Post  
Thanks Bharat , e-mail sent
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #39 - Mar 28th, 2005 at 10:03pm
Print Post Print Post  
wow, thats nice. its going to take some time for me to absorb that. thank you for example.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #40 - Mar 29th, 2005 at 12:39am
Print Post Print Post  
The userslect works well, but I would like it to auto type other fields from the same to LEs on the main form that would be like xlookup filename(newdispatch), key(company name), form name(equipment list)!ext key(company name), a second key field (equipment type) then target. 
and then i want it to guess the winning lotery numbers. well maybe not that the lotery ticket thing. am i asking too much?
its so I can pick out a piece of equipment on the dispatch form and it fills in the model and serial number. the more I study the more it says no or least not with a lookup that im used to.  I have the natural links or could it be done in relative links instead?
Thanks always
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #41 - Mar 29th, 2005 at 3:20am
Print Post Print Post  
Quote:
I would like it to auto type other fields from the same to LEs on the main form that would be like xlookup filename(newdispatch), key(company name), form name(equipment list)!ext key(company name), a second key field (equipment type) then target.


Once you have got the key in the form with Userselect, or Popupmenu or Combobox, getting other fields to be filled out should be easy.

On Element Exit Event, write multiple @lookups if you are getting value from different forms, or use @XLookupsourcelist  if you are getting all the values from the same forms.

Target1 = @xlookup (filename, key, "form!ext.key", "Source")

Target2 = @xlookup (filename, key, "form!ext.key", "Source")

Target3 = @xlookup (filename, key, "form!ext.key", "Source")

On and on....

If you are getting values from same form then


var vReturnval as string
var str1 as string
var str2 as string
var str3 as string
vReturnval = @XLookupsourcelist (Filename, key, "Form!ext.key", "source1;source2;Sourc3") 
str1 = @AccessStringArray(vReturnval, 1)
str2 = @accessStringArray(vReturnval, 2)
str3 = @accessStringArray(vReturnval, 3)
Target1 = str1
Target2 = str2
Target3 = str3

Quote:
I have the natural links or could it be done in relative links instead?


Once you get the key value in the form you are filling out, that should not make any difference.

FlipGilbert, did I understand right as what are you trying to do? or I am off the target!!!
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #42 - Mar 29th, 2005 at 4:15am
Print Post Print Post  
No, I think your on target. its me having difficulty understanding. When you put it like you just did it makes a little more sense. Im going to try this. You are being more than helpful.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #43 - Mar 29th, 2005 at 4:25am
Print Post Print Post  
When you select the key, be careful, the external file should have one to one relationship, else it will give you the value of the first match and that is not what you wanted.

To make this point stick, let us take example of the display form in Countries1.db.   If you want to get population value from "Cities" form in the display form, key must be "City".  If you use "Country" as a key, many cities are in one country and hence you will get the value of the first match of the country.. and that is not you want. Key might be different for different value you need to have from different forms.
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #44 - Mar 30th, 2005 at 11:19pm
Print Post Print Post  
Bharat
After studying the code you sent, I now have more questions than answers.  I will use the name of the db you sent me to keep it simple.

Im using a converted Q&A database and in the DISPLAY form it has a text field for the COUNTRY form element not a combo box. I will type in the country in manually or more accurately it will be filled in already by the time I get to the CITY form element.

I would like a userselect for the CITY form element, thats also a text field, that I can choose to fill in the CITY form element and automatically fill in the POPULATION form element on the DISPLAY form.

Do I need to change over to combo boxes? Thanks for your help
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #45 - Mar 31st, 2005 at 6:41am
Print Post Print Post  
Userselect, @popupmenu and combobox -  they basically work the same way and for the same purpose. If the list is short, I prefer combo-box or Popupmenu (even that is not right as with ability to dynamically updating combobox list (and popupmenu) , as done in the City element of display form). Conversely if the list is very  long, with @xuserselectr, one can narrow it down by searching for particular string while entering data in the field.  If you do not want to use combobox, you can use ordinary text element and use either @Popupmenu or userselect.  Good part about them that you never have to type anything, entry is always valid and fast. All new stringarray functions addition in ver. 1.04 and ver. 1.1 makes the job of string manupulation a whole lot easier. What one could achieve earlier by string manupulation with arrays and loops, now can be done with a simple statement.
  
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: UserSelect Question
Reply #46 - Mar 31st, 2005 at 3:32pm
Print Post Print Post  
Quote:
All new stringarray functions addition in ver. 1.04 and ver. 1.1 makes the job of string manupulation a whole lot easier. What one could achieve earlier by string manupulation with arrays and loops, now can be done with a simple statement.



To emphasize the above point, let us go to the begining of the link, where you inquired if it was possible to narrow down a long list in the useselect list. We, indeed, went really long way using filtering function, loop, subroutine and achieve our goal halfway. ( I said halfway because we did not tackle ..abc search)  

The same thing (and more as it also include ..abc search) can be accomplished in just one statement.

Let's say, you want to have CustomerName from Customer.db - Customer_Info Form where it is in Name element

On Element Exit Event

If @in (CustomerName, "..") > 0 then
     
CustomerName = @Popupmenu (@xlookupall("Data\customer.db", CustomerName, "Customer_Info!Name", "Name"), "Customer Names")

That is it.  With Sesame more deeper one goes, more pearls he finds!!!

Nothing wrong with the previous approach but that was before version 1.1.  

For this you can use also userselect or Combobox. The important thing is that you are getting the string of values, and here, we did not have to manupulate string. Thanks Mark, for giving @xlookupall function which is very useful for working with One to Many (or Many to Many since we can use search) relationship.
« Last Edit: Apr 1st, 2005 at 6:33pm by Bharat_Naik »  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #47 - Mar 31st, 2005 at 10:32pm
Print Post Print Post  
That is truly the most beautiful thing I have seen this week! Yeah I dont get out much as of late.

Thank you for the pearls!  Cheesy
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #48 - Apr 1st, 2005 at 5:34am
Print Post Print Post  
[quote author=Bharat_Naik  link=1111180599/45#46 date=1112283132]
On Element Exit Event

If @in (CustomerName, "..") > 0 then
     
CustomerName = @Popupmenu (@xlookupall("Data\customer.db", CustomerName, "Customer_Info!Name", "Name"), "Customer Names")
[/quote]

thats exactly what I had in mind for the primary field. in my example
Machine type = @Popupmenu (@xlookupall("Data\newdispatch.db", Company Name, "equipment list!co_name", "Equipment type"), "equipment type")

I cannot do an xlookup on the equipment type from the equipment list form because many customers have the same equipment. I would like to pull the model and serial from the selected subform to add to my main form. Is that possible?
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #49 - Apr 1st, 2005 at 6:12am
Print Post Print Post  
Quote:
I would like to pull the model and serial from the selected subform to add to my main form. Is that possible?



How do you enter the Data of Model and Serial in the SubForm? Do you have another external or internal database, (by external, what I mean is outside of application), where you list EquipmentName, EquipmentType, ModelNumber etc. May be Serial# is Unique for each piece of equipment but may be first few numbers might be common for particular equipment_type and last few digits would be unique. Once you get a Unique Key, you can autotype the respective element values in the form you are working on from another forms. If the key is not unique, you can get a shortened list displayed, One to Many relations, from where you have to pick up one applicable from the pickup list. Usually rule of thumb  is that, if you enter data in your database once, you should not have to re-type  it again manually. How easily you have it accomplished, depends largely on appllication design.

Unfortunately, sometimes there is duplication of data since you cannot output either on report or mailmerge without data being in the same form you are working with, but in the trade off,  we are having simple, uncomplicated database program that works well for us.

Quote:
Yeah I dont get out much as of late.


Sorry to hear that, but do not hesitate to ask anything that is puzzling you. There are many extremely knowledgable people on this board who will go out miles to help you. Even the lanticans, who are the heart and soul of this product, are available to guide you when nothing else helps.  So, please do not get discouraged.  Give us the concrete example what exactly you are trying to do. It is really difficult sometimes to know exactly what you are planning to do, particularly without looking at your application.

« Last Edit: Apr 1st, 2005 at 1:40pm by Bharat_Naik »  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #50 - Apr 1st, 2005 at 3:02pm
Print Post Print Post  
First off I would like to thank you Bharat for your time with me on this. Also to the many others that help. I have been studying this for about four months and any frustrations I have are from not being able to understand or comprehend what is being told to me. I do so much appreciate everyone&#8217;s help and patients with me.
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #51 - Apr 1st, 2005 at 3:51pm
Print Post Print Post  
Quote:
Usually rule of thumb  is that, if you enter data in your database once, you should not have to re-type  it again manually. How easily you have it accomplished, depends largely on appllication design.  


Conversely, while inputing data, if one  types up the same thing again and again, he has to ask, how can he avoid it.  It might involve making a small database external or internal and/or adding a little code.
« Last Edit: Apr 1st, 2005 at 6:32pm by Bharat_Naik »  
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: UserSelect Question
Reply #52 - Apr 1st, 2005 at 4:31pm
Print Post Print Post  
Sometimes it is easier to create an XLU into itself, the same file, looking in the same field, to get a list of existing values to choose from.  Then, every time a new value is added on a record, that LU list will be increased.   That eliminates the need to make a separate database for values to use in that element. 

You could also program the element not to accept anything that is already added once you have an example of every desired value established.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
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: UserSelect Question
Reply #53 - Apr 1st, 2005 at 5:34pm
Print Post Print Post  
Thanks Bob, for your input. That will definitely avoid making other database.  Filp, I am sure you realized that Bob is probably referring to (Bob, please correct me if I am wrong) to @xlookupall in the same element and then making it Unique by using @UniqueStringArray function:


On Element Entry Event
=======
var vString as String
vString = @xlookupall (@fn, "/= ", "Equipment_List!EquimentType", "EquipmentType")

vString = @UniqueStringArray (vString)
vString = @SortStringArray (vString, 0)

EquipmentType = @PopUpMenu (vString, "Equipment Type")





« Last Edit: Apr 1st, 2005 at 9:16pm by Bharat_Naik »  
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: UserSelect Question
Reply #54 - Apr 1st, 2005 at 6:17pm
Print Post Print Post  
Once again, WELL DONE Bharat_Naik! Grin

Thanks for the code example. 

I am usually quick with the ideas, but don't have the time to put together the code for theoretical examples. Roll Eyes  But you understood exactly what I meant.  Shocked

A variation could populate a combo box vs. a pop-up menu.

  



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


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #55 - Apr 1st, 2005 at 6:55pm
Print Post Print Post  
I hope this helps explains my query.

I have only 1 database named [newdispatch.db] it has many forms. My main form is called [dispatch] it has a most excellent lookup (thanks to all of you) of the customers names and fills in the customers address, phone and other info from the [CUST] form.

The [dispatch] form also has fields named (Machine Type) (Model) and (Serial).
I have a userselect menu in the (Machine Type) field that looks up in the [Equipment list] subform of the [CUST] form and pulls up all of the equipment of that customer. That works exactly as desired and looks like this

If @in (Machine Type, "..") > 0 then

Machine type = @Popupmenu (@xlookupall("Data\newdispatch.db", Company Name, "equipment list!co_Name", "Equipment type"), "equipment type")

I would like to be able to auto fill the (Model) and (Serial) fields on the [Dispatch] form with the info from the (Machine Type) field from the subform [Equipment List]

Many of my customers have the same type of equipment (but not the same serial number) so I cant do the xlookup (abc machine) from the (machine type) field. I would have no objections of adding a key field if need be.


This might be a better break down on my db

[Newdispatch.db]

[Dispatch] form, fields we are dealing with (Company Name), (Machine Type), (Model), and (Serial).

[CUST] form fields (Customer Name)

Natural linked to [CUST] its subform [Equipment List] subform. fields (Equipment Type), (Model No), (Serial No), (Other Info), (co-name)

I am absolutely clueless when it comes to variables strings and such. where might I read up on these subjects?
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #56 - Apr 1st, 2005 at 7:32pm
Print Post Print Post  
Hello Flip,
This time you are very thorough in your description of query and problem you are confronted with. You do not have the recognizable unique field the Equipment_Type subform. I said recognizable as eventhough, serial number is unique but you would not know what does it represent just by looking at it. You do have two elements in the subform, namely Customer and equipment, if somehow if you join it, that will become unique. The important thing is that you already got both of them in Dispatch form. You never have to even look at it. Let's say you combine first 6 letters of customer or company's name and first six letter of equipemt type combine and make unique value in the subform and assigned it to newly formed element which is always hidden, you never have to look at it.  Ofcourse, one has to remove any white space by programming. Now you have 12 letters unique key. You may make it less, if you please.  You do not have to make any additional element in dispatch form.  That is it. Now you can autotype all the required field, including serial# etc.


  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #57 - Apr 1st, 2005 at 8:10pm
Print Post Print Post  
I am so glad you you didnt say all you have to do is......
and show how stupid simple it might be, or how I might be!  Cheesy
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #58 - Apr 1st, 2005 at 8:18pm
Print Post Print Post  
Seems like a little inefficient, but workable. Let's say you make one element in Subform name UniqueKey

var vCompany as String
var vEquipment as String

//Removing white spaces

vCompany = @replace (Company, " ")
vEquipment = @replace (Equipment_type, " ")

//making UniqueKey by combining first six letters of each

UniqueKey = @left (vCompany, 6) + @left (vEquipment, 6)

Hide the UniqueKey Element after you make certain it works well, this will save some realestate in the subform.

In the Dispatch form in Element Exit Event of EquipmentType

//You have already gotten company and EquipementType

var vUniqukey as String
var vCompany as String
var vEquipement as String

vCompany = @replace (Company, " ")
vEquipment = @replace (Machine_type, " ")

vUniqueKey = @left (vCompany, 6) + @left (vEquipment, 6)


//Now the xlookup

SerialNo = @xlookup (@FN, vUniqueKey, "Equipment List!UniqueKey", "SerialNumber")

Model = @xlookup (@FN, vUniqueKey, "Equipment List!UniqueKey", "Model NO")

I might be way off on the naming of elements and forms but you know it well, so I am not verifying with your note.

You have some white spaces in the name of Elements and form names. It is not a good Idea to have that.

Please let us know what happens.  I could not possibly test this but conceptually this should make things clear.





  
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: UserSelect Question
Reply #59 - Apr 1st, 2005 at 9:02pm
Print Post Print Post  
You still might run into problem if the customer orders or owns the same type of equipment and they are listed in the different lines of subform, thus Unique value will not be Unique. I really do not know how often does that happens. If it happens, it will not give error but take the value from the first availble record. If this happens quite often, one will have to explore feasibility of using @xlookup all and if it gives 2 or more string value then it should give you warning and let you choose one appropriate one. In this case you will have to click on one to select that. I hope, I am clear.
  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #60 - Apr 1st, 2005 at 9:27pm
Print Post Print Post  
You dont know it but you have explained what I need to do. The Equipment type needs to be modified to have not only the name but the model and serial numbers as well. All in the one field. I do not need to separate all the different fields. See!! You did make it look so simple. This will work out very well and save a lot of time in data entry and in programming.  Grin
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #61 - Apr 1st, 2005 at 10:01pm
Print Post Print Post  
oh well sounded good on paper anyways. the information in the popup field if to long gets cut off.   Undecided

  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #62 - Apr 1st, 2005 at 10:17pm
Print Post Print Post  
or like you said earlier.....

I can add a key number after the name like
(equipment name  0123) making the equipment name a key field for me to do the xlookup.
is there a way to hide the number field from view. not an issue if not.   

is there a way to add this number key to the end of the equipment name? in a mass update!
oh great!  now Im talking to myself.
my hair is on fire, im so glad its friday  8)
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #63 - Apr 1st, 2005 at 11:19pm
Print Post Print Post  
Quote:
I can add a key number after the name like 
(equipment name  0123) making the equipment name a key field for me to do


So you have the KeyField, I believe that is sequential unique number that you might be deriving from @number or Globalvalue.  Good thinking... better than I suggested to combine two names as this will be always unique. If you have unique key value in each record of subform Equipment List, you may represent the key in say String of five digits with filling up with zeros up front if it is less than five digits long...such as 00005 or 00324.

You get the string in form dispatch using @xlookupall, and it would be like equipment00124 unless you are prepared to put couple of more elements. Eventhoght display will show the number, when you will choose the item, Equipment_Type element will take only equiment name and key will go to another element or for better presentation and readability you may present list as   "Equiment         00124"  format that is more pleasant to look at. Just a thought.

  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #64 - Apr 1st, 2005 at 11:32pm
Print Post Print Post  
another nice idea, thank you for you help on this. Im so glad this works. I was about to call it quits but am very thankful you stayed with me and helped me. thank you and Bob and Carl and all great folks for your support! oh! and Lantica and the folks over at Hammer Data!  and ....*the music comes on and someone shouts  GET OFF THE STAGE!!*  Shocked
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
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: UserSelect Question
Reply #65 - Apr 2nd, 2005 at 7:38pm
Print Post Print Post  
Flip, Glad to know that it worked out for you as you wanted it to.  I was thinking about how it could be done without changing any structure or making any new field. Since now you already made the changes and added an extra-element or modified and made it work, this discussion is just academic value and may be just theoretical. I believe the following should work if we call the above subroutine after picking up equipment on element exit event. Subroutine goes in the Global Code.

var vEquipmentInfo as String
vEquimentInfo = @xListValueAll(@FN, Company, "Equipment_List!CompanyName","CompanyName;SerialNo;Model")

vEquipmentInfo = @Repleace (vEquipmentInfo, @newline ( ), ";")

Subroutine Populate_fields()
var t as array[20, 3] of String  //company could have upto 20 equiments
var i as Int

//Populate Array

i = 1

While @len (vEquipmentInfo) > 0
     t[i,1] = Split (vEquipmentInfo, ";")
     t[i,2] = Split (vEquipmentInfo, ";")
     t[i,3] = Split (vEquipmentInfo, ";")
     
i = i + 1



//Loop to find the value of Equipment and when found assign value of serialNo and Model

For i = 1 to 20

      If t[i,1] = Equipment
         {
           Serial = t[i,2]
           Model = t[i,3]
           i = 20
         }
     Else
           i = i + 1

Next      

End Subroutine

===============

I did not debug the above codes and did not check the names of elements but concept and logic should be understandable.

I would like request the Lantica Development team to include the availability of simple function, in which one could combine two or more external key elements to make it Unique to be used in some of the x-family functions, that will obviate the need to change the structure or add any additional element to make an Unique key.

May be I should request this in a separate link.





  
Back to top
 
IP Logged
 
FlipGilbert
Full Member
***
Offline


Running Ver 2.6.4

Posts: 236
Location: Sandy Eggo
Joined: Mar 8th, 2005
Re: UserSelect Question
Reply #66 - Apr 3rd, 2005 at 3:02am
Print Post Print Post  
I will give this a try in the future. most important is to thank you for helping me
  

It's not what a man says that matters or how he says it, but what he does and how he does it.
Back to top
 
IP Logged