Normal Topic Using Data on Alternate form Question (Read 1102 times)
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Using Data on Alternate form Question
Jul 13th, 2007 at 6:30pm
Print Post Print Post  

When working with a form in the same database (think using Alternate form) I thought I would have access to the same element data from the other form in the database (I have to quit thinking about the way Q&A win did it)  but I guess that is not the case.

What is the best method to work with the data from the other form in the database?

I was putting a Command button on my form that fills the form 1 time using existing data and then making the fill button invisible once it was used once. I was planning on just using stuff like:

LDF_2 = userfullname // userfullname is a field in this database and an element on the other form.

Should I do a lookup (using one of the many commands at my disposal) to the database 1 time and return all the data I plan on using in this form  to variables and then work with it. Or do a lookup as I need it or do something entirely different.

I know I can create new elements on this form and bind them to the existing fields in the database. I have done this on other alternate forms and it has worked well, however on the form I was working on I want the data to remain static once processed and not change if someone changes the underlying field.

Thanks
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Re: Using Data on Alternate form Question
Reply #1 - Jul 17th, 2007 at 10:50am
Print Post Print Post  
Hello Robert -

I'm sorry to see that you have not had a response to this. But I understand why .. I had to read your message more than once and I'm still not sure I understand the question.

If I understand it correctly ..
On a form you can bind several LE's to the same field. Same data. When one changes the others change. But that's not what you want. You want to capture the current data and show it in alternative fields. So there's a "Current name" field and a Current Name LE, then a "Original Name" LE. You want to click on a button and 'capture' the Current Name and show it in the "Original Name" LE. If someone subsequently changes the Current Name you want the new name to show in the Current Name LE but the Original Name LE to remain unchanged. To do this there is no alternative to having fields for both - Just as you would have done in Q&A. Have your command button copy the contents of CURRENT FIELD into ORIGINAL FIELD when you want. You don't need XLookup, just something like..

cmdCaptureName - On Element Entry:

Original Field = Current Field
ReadOnly(cmdCaptureName, 1)
  

Alec
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Using Data on Alternate form Question
Reply #2 - Jul 17th, 2007 at 11:35am
Print Post Print Post  
Alec wrote on Jul 17th, 2007 at 10:50am:
I had to read your message more than once and I'm still not sure I understand the question.

Thanks, I thought it was just me. Smiley
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Using Data on Alternate form Question
Reply #3 - Jul 17th, 2007 at 3:01pm
Print Post Print Post  
Sorry about the confusing explanation.

Alec you have the concept of what I want to do. My original thought for a solution was exactly what you explained but at least for me (I might be doing something wrong) It will not work as you described using Alternate form.


When working in Sdesigner  on the alternate form in the same database you can not use

Original Field = Current Field

Original field (the field or element from the other form in the same database) is not valid in the alternate form (I had thought it would have been) So I am forced to do a lookup of some sort.

I would love for someone to tell me I am wrong about this and tell me what I am doing incorrectly, because it would be ideal if as I had hoped the elements or fields were interchangeable on all forms in the same database.

As stated in the previous post you can bind a new element to a field in the same database, but this would mean I would need 2 elements for every field I want on my alternate form. In your example Alec I would first need to make a new element on my alternate form bound to original field and then another element on my alternate form called current field then I could use Original Field = Current Field. Then I end up with 3 fields in the same database to achieve my goal.


  

Team – Together Everyone Achieves More
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: Using Data on Alternate form Question
Reply #4 - Jul 17th, 2007 at 4:57pm
Print Post Print Post  
Can you do Redraw with ImmediateChange?
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Using Data on Alternate form Question
Reply #5 - Jul 17th, 2007 at 5:49pm
Print Post Print Post  
Hello Robert,

A Form or Report can only see those elements which are physically on it, so Original Field = Current Field  will not work if one of those elements does not exist on the form where the programming exists.

If you do not want to have other Layout elements bound to the underlying field then, Yes you will need to use a X command and probably either @XResultSetSearch() or @XLookupSourceList()

-Ray
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Using Data on Alternate form Question
Reply #6 - Jul 17th, 2007 at 6:53pm
Print Post Print Post  
Thanks Ray,

That’s what I figured.

Would using a lookup or the use of additional bound elements be the least taxing on Sesame. I have no problem solving my goal a half a dozen different ways but I am not sure what method is the most efficient to Sesame.

Thanks again everyone for all the help.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Using Data on Alternate form Question
Reply #7 - Jul 17th, 2007 at 7:34pm
Print Post Print Post  
Hello Robert,

If you are worried about Application size then go with an X command. As for speed, I can not say which one would be faster, as I am not sure.

btw I figured out a neat little way to get field values from the underlying database. It can be seen below. Since the XResultSet commands work on the Database themselves and not on the form, they are more powerful than the normal X commands.

The code below is for a second form in the Customers database in the samples Customers.db file. It has an unbound element named company on it, but it grabs the value from the database field company and fills in the element.

Code
Select All
Var vRS as Int
Var vCurPos as Int

vRS = @XResultSetForm("")
Company = @XResultSetValue(vRS, "Company")
XResultSetClose(vRS) 



-Ray
  

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


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Using Data on Alternate form Question
Reply #8 - Jul 17th, 2007 at 9:20pm
Print Post Print Post  
Quote:
btw I figured out a neat little way to get field values from the underlying database. It can be seen below. Since the XResultSet commands work on the Database themselves and not on the form, they are more powerful than the normal X commands.

-Ray


Ray,

You are one Smart cookie!  It works like a charm. (however I am not sure why exactly)

I have read the documentation on @XResultSetForm and @XResultSetValue and am still a little uncertain of how this works.

Would you mind explaining exactly what is going on with this code.


This is what I am using


Var vRS as Int


vRS = @XResultSetForm("")
LDF_1a = @XResultSetValue(vRS, "propertylast")
LDF_17 = @XResultSetValue(vRS, "propdocnum")
LDF_28 = @XResultSetValue(vRS, "PropertyBrokerCompany")
XResultSetClose(vRS)
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2482
Joined: Aug 20th, 2003
Re: Using Data on Alternate form Question
Reply #9 - Jul 18th, 2007 at 1:55pm
Print Post Print Post  
BOBSCOTT wrote on Jul 17th, 2007 at 9:20pm:
You are one Smart cookie!


Thank you.

Quote:
Would you mind explaining exactly what is going on with this code.


No problem.

Code
Select All
vRS = @XResultSetForm("") 


This gets the ResultSet from the current form. So if you have retrieved 10 records in Search/Update, your XResultSet will have the same 10 records. If you are on the 5th record in Search/Update, you will be on the 5th record in the XResultSet. Since the XResultSet commands act on the database they have access to every field in the database for any particular record.

Code
Select All
LDF_1a = @XResultSetValue(vRS, "propertylast") 


This gets the value from the propertylast FIELD for the current record and places it in LDF_1a ELEMENT on the current form.

Code
Select All
XResultSetClose(vRS) 


This closes the XResultSet which is a necessary step when working with XResultSets.

Anything I need to clarify more?

-Ray
  

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