Page Index Toggle Pages: 1 [2] 3  Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) Selection box (Read 7123 times)
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: Selection box
Reply #15 - Jan 27th, 2004 at 3:06pm
Print Post Print Post  
Your conversation sounds fascinating. It is encouraging that others can accomplish lofty goals in sesame. I on the other hand can not get past basic selection lists. 

I took a fresh approach  last night and tried to simplify this process. I am trying this task with 2 single form databases for simplicity.

I started new db, 1 form 2 fields the fields are e1 and e2
I will use the sample zipcodes.db from sesame.

I put

XUserselectr("C:\Sesame\Data\zipcode.db", "zipcode!state", "State", "A"," Z", e2)

In on field exit  program of e1

I thought that when I exited field e1 I would receive a selection list made up of  info from the state field in Zipcode.db  then that info would return the selected state to field e2 once selection was made.

When I leave e1 sesame says working but it just runs indefinitely until I ctrl alt del to menu that says not responding.

What can I possibly have wrong in such a simple task?
  
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: Selection box
Reply #16 - Jan 27th, 2004 at 3:16pm
Print Post Print Post  
If you want to display the whole list, you just have to use xusrselect command. Why do you have to go through xuserselectr, start and end.... etc. Did you try the modified code for your form I posted to be placed in Purchase form in PurchaseFrom element and GlobalCode ?
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection box
Reply #17 - Jan 27th, 2004 at 4:23pm
Print Post Print Post  
Bill,

I have emulated exactly what you have described. I used zipcodes.db. and your logic of XUserselectr("C:\Sesame\Data\zipcode.db", "zipcode!state", "State", "A"," Z", e2)

I think I see why you think it is not working. 

After you exit e1 wait. DO NOT use task mgr to exit. It takes a while for some reason but after a few minutes it will bring up a selection list.

It took about 90 seconds for the selection list to be presented.

Let us know if this thought is correct. Thanks Smiley

I realize that it is working on 43042 records in Zipcode database but it still seems like an excessively long time to generate.

Can anyone explain why it is taking so long for this selection box?

I even changed  billgordons logic from a-z to XUserselectr("C:\Sesame\Data\zipcode.db", "zipcode!state", "State", "M"," P", e2) to see if it had a different effect. Still very slow.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Selection box
Reply #18 - Jan 27th, 2004 at 4:31pm
Print Post Print Post  
Bob,

The first time you use any of the "X" commands, it will be pretty slow depending on the size of the .db / .dat files you are accessing. Subsequent operations should be substantially faster - especially if you are using (the now available 1.0.1 release).

To avoid the slow first access, merge (always using a backup!) the two databases and use an internal xlookup.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: Selection box
Reply #19 - Jan 27th, 2004 at 7:27pm
Print Post Print Post  
Yes Bob you were correct!  Thank you.

Now  Bharat_Naik to follow  your example and have it use what I place in a field and have a selection box . I put this  code  in Global Code   (even though I do not understand what it is doing)
 
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 

Then I placed this in my  e1 Element on element exit event.  I have adjusted it to the name of my new test  database name. 
 
if @in(e1, "..") > 0 then   
 

  vFieldName = e1 
  picklist_choose ( ) 
   
  e2 = @XUserselectR ("C:\Sesame\Data\zipcode.db", "zipcode!state", "state", vStart, vEnd) 
 
}

Nothing at all happens. What is wrong? 
  
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: Selection box
Reply #20 - Jan 27th, 2004 at 9:48pm
Print Post Print Post  
Bill, we are using this code for different purpose. What you want to do here is, put State Name in two letters and it should display the list of certain zipcodes for that state only.

The modified code might work for this purpose. I did not try it but this is mainly to shorten the list to display according to the initial string of the value.

As for example

If you want to have list of anything that begin with "Wh..", it will display white, whitehall, white House etc... from the whole list of say 3000 values.

  
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: Selection box
Reply #21 - Jan 27th, 2004 at 9:57pm
Print Post Print Post  
Bill, we are using this code for different purpose. What you want to do here is, put State Name in two letters and it should display the list of certain zipcodes for that state only.

The modified code might work for this purpose. I did not try it but this is mainly to shorten the list to display according to the initial string of the value.

As for example

If you want to have list of anything that begin with "Wh..", it will display white, whitehall, white House etc... from the whole list of say 3000 values.

  
Back to top
 
IP Logged
 
billgordon
Junior Member
**
Offline


No personal text

Posts: 61
Joined: Dec 31st, 2003
Re: Selection box
Reply #22 - Jan 28th, 2004 at 7:37pm
Print Post Print Post  
I am so FRUSTRATED!  I have read the book, read these posts over and over again. I still have not succeeded at doing what has been done before.

I now have 1 app with 2 databases
App is called myapp
Database 1 is entry
Database 2 is name

Database2 has a field called lastname
Dataebase1 has a field called ordername

I want to enter part of the last name in ordername field and when I exit ordername it will create a selection list from database2 lastname field with just the names that are close and when I select that name it returns that name to ordername.

Example. If I enter Smi the list would contain all the last names from database2 that start with SMI.

I am not the dumbest person in the world, even though it looks it at the moment. I have really put the time and effort into trying to accomplish this on my own but without  classes or more examples for me to learn from I am doomed.

I appreciate all the help I have received from people out here already, Bharat_Naik has put a lot of effort in trying to show me and I have traded emails with BOBSCOTT on things to try but to no avail

So please once again Bharat_Naik or BOBSCOTT or any other kind sole  please try to post  an example one more time with an explanation of what  programming I should have and what the programming is doing each step of the way.

Than you
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Selection box
Reply #23 - Jan 28th, 2004 at 8:33pm
Print Post Print Post  
For the example I have merged the example applications Gems.db and Customers.db.

By putting the following code in the On Exit of the Gem_Type LE of the "Gems Types" form of the "Gems Types" database:

// declare some variables - all strings
var v_result as string
var v_start as string
var v_end as string

// set start value to the contents of the field we are in
v_start = Gem_Type

// set the end of the range to that value with a bunch of "z"s
// tacked on to force the full alphabetic range. If the user puts
// "PAR" in the field, this wil force the range to include anything
// that starts with "PAR" through "PARzzzzzzzz" - including
// "PARIS" and "PARKMAN".

v_end = v_start + "zzzzzzzz"
v_start = v_start + @chr(1)

// In this application file, look at the form named "Main Form" for
// the LE named "City" - if its contents are in the range starting
// with what the user typed into "Gem_Type" and ending with
// that value with a bunch of "z"s concatenated on it - then
// return the value in "City" to the User Select list. If the user
// selects one of those City values, return the value in City and
// put it in the variable "v_result".

v_result = @XUserSelectR(@fn, "Main Form!City", "City", v_start, v_end)

// Put the value in "v_result" back into the LE "Gem_Type"
Gem_Type = aa


I got what I think you are asking for using Sesame 1.0.1. Remember that you need to test any of the X functions (XUserSelect, XLookup, etc..) using the actual Sesame runtime - not the Preview option of the Designer.

I stripped out all the error checking and other niceties, so this would be easier to follow. The lines beginning with "//" are comments and you do not need to type those in, they are there to give you a blow by blow explanation of what is happening.

The hard parts here are that you have to remember to use the form name when specifying the "ext select", but *not* use it again for the "source". So the external select is:

Form Name!LE Name - in the example: "Main Form!City"

But the "source" is just "City".

In the your example you would probably use something like:

//------------------ On Exit from ordername
var v_result as string
var v_start as string
var v_end as string

v_start = ordername

v_end = v_start + "zzzzzzzz"
v_start = v_start + @chr(1)
v_result = @XUserSelectR(@fn, "entry!lastname", "lastname", v_start, v_end)
ordername = v_result
//-----------------------------

if your form is named the same thing as your database (it usually is).

I hope this helps. If you have any questions at all - do not be afraid to ask.
« Last Edit: Jan 29th, 2004 at 3:03pm by The Cow »  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection box
Reply #24 - Jan 28th, 2004 at 10:10pm
Print Post Print Post  
Mark Lasersohn,

I can not speak for Bill but I sure liked your step by step explanation. Thanks Cheesy

I have one problem when I apply your example to my application. Everything works fine in the creation of the pop-up list, However it does not return the value to my element.

I thought possibly this is because it is returning the value to an elelement on a subform so I tried this from the actual form and still had the same result.

I then added the writeln line to display the value of V_result

eventphysican = v_result 
writeln(V_result)

The widow shows it is empty nothing to return.

Thoughts?

Thanks,

Robert
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Selection box
Reply #25 - Jan 28th, 2004 at 10:15pm
Print Post Print Post  
What does @error say about it. The X functions will set @error if they fail.

  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection box
Reply #26 - Jan 28th, 2004 at 10:34pm
Print Post Print Post  
Quote:
What does @error say about it. The X functions will set @error if they fail.

I put this in
eventphysican = v_result 
writeln(@error)

It returns a NO
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Selection box
Reply #27 - Jan 28th, 2004 at 10:53pm
Print Post Print Post  
Is it meant to return the same LE that appears in the menu or a different LE on the same form?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Selection box
Reply #28 - Jan 28th, 2004 at 11:11pm
Print Post Print Post  
In this instance I was returning the same. I was following along with yours, Bharat and Bills examples.

var v_result as string
var v_start as string
var v_end as string

v_start = eventphysican

v_end = v_start + "zzzzzzzz"


v_result = @XUserSelectR(@fn, "physicians!last", "last", v_start, v_end)

eventphysican = v_result 
writeln(@error)
  

Team – Together Everyone Achieves More
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: Selection box
Reply #29 - Jan 28th, 2004 at 11:22pm
Print Post Print Post  
Mark, it still does not work with space without putting @chr (1) in var v_start for the search for the whole word which is followed by a space.

"Blue" would not pull up Blue Cross

Bl  will list everything starting with Bl.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send Topic Send Topic Print Print