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 12531 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 #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’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
 
Page Index Toggle Pages: 1 2 3 [4] 5 
Send Topic Send Topic Print Print