Page Index Toggle Pages: 1 [2] 3 4 5 Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) UserSelect Question (Read 12532 times)
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
 
Page Index Toggle Pages: 1 [2] 3 4 5
Send Topic Send Topic Print Print