Normal Topic Switch to Alternate Form (Read 1632 times)
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Switch to Alternate Form
Oct 21st, 2008 at 2:07pm
Print Post Print Post  
I want to use a Button The Switch to an Alternate, in Form Update mode, allowing me to select a different form to view the same record.
4 Forms are attached to the same database. alternate forms present many fields as the original form,  a combination of unique and shared fields.
When an alternate form is opened, i want that the original form and the alternate form are opened showing the same record.
I would like that the original form and the alternate form both remain open.
Is that possible?

Thank you for your help!
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Switch to Alternate Form
Reply #1 - Oct 21st, 2008 at 2:16pm
Print Post Print Post  
Amor,

Alternate forms are meant for looking at a different view of the same record. If you leave them both open, changes made on one will not be reflected on the other and there is a danger that a user can overwrite their own changes. Are you sure you want to take this approach?
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Switch to Alternate Form
Reply #2 - Oct 21st, 2008 at 2:35pm
Print Post Print Post  
Erika you are right!
I noticed the Alternate Form commands from Tree is very slow. I simply wish the Navigation faster and secure.

Your opinion is appreciated!
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Switch to Alternate Form
Reply #3 - Oct 22nd, 2008 at 12:01am
Print Post Print Post  
Amor,

Alternate Form shouldn't be slower than navigating to the form directly. It may seem slower as the process of saving the current record, loading the new form, compiling the code and getting the same record displayed happens all at once, as opposed to happening in several stages as it does when you search manually for a record.
  

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


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Switch to Alternate Form
Reply #4 - May 28th, 2009 at 12:41pm
Print Post Print Post  
Hello!
I am trying to use switch to the alternate from a Main Menu.

I added a new three forms to an existing database (Form).

and wand tu use the @XResultSetSearch Function to open directly  the desired form.
But I have no idea why it does not work.


Form : Aufnahme

the new three Copies von Aufnahme Form
                  Chemie
                  Sero
                  Allergie


Hier ist  the code

var vRS as Int
var vDatei as String
var vList as String
var vVorname as String
var vNachname as String
var vgeb as Date

vVorname = ".." + Select Vorname + ".."
vNachname = ".." + Select Nachname + ".."
vGeb      = @Str(Select Geb)

vDatei =  "Aufnahme" ( it is OK)
vDatei = "Aufnahme!"+Select Datei (not OK)
//writeln(vDatei)

vRS = @XResultSetSearch(@FN,vDatei, 0, 2,"!Nachname=" + vNachname,"!Vorname=" + vVorname,"!Geb="+ vGeb)
If @XResultSetTotal(vRS) > 0

                       {
                             clear(Select Nachname;Select Datei;Select Vorname;Select Geb)
                             
                             XResultSetOpenForm(vRS, vDatei)
                             XResultSetClose(vRS)
                               
                       }
else
@msgBox("Diese Auswahl wurden nicht gefunden","","")




  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Switch to Alternate Form
Reply #5 - May 28th, 2009 at 2:18pm
Print Post Print Post  
Hello Amor,
Is the form 'Aufnahme' your main menu? Do you enter any data directly on the 'Aufnahme' form?  Are all of your forms in the same database?

If so you may want to add a command button (SwitchForm in this example) and try the programming below:

SwitchForm :: On Element Entry
Code
Select All
var vCurrentForm as String
var vAltFormList as String
var vSelection as String
var vLaunch as Int

     vCurrentForm = @Layout // Save Current Layout Name To Variable
     vAltFormList = "Chemie;Sero;Allergie" // List of Alternate Forms **USER MODIFIABLE**
     PopupSelectPosition(4, @XPOS(SwitchForm), @YPOS(SwitchForm)) // Set menu to appear on the button
     vSelection = @PopupMenu(vSelection, "Select An Alternate Form") // Pick a form to load

     FormCommit("") // Save current record
    
     If @Add Then
     {
	    vLaunch = @SelectTreeItem("Add Data Menu!Switch to an Alternate Form!" +  vSelection)
	    FormExit(vCurrentForm) // Close this form
     }
     Else If @Update Then
     {
	    vLaunch = @SelectTreeItem("Search Update Menu!Switch to an Alternate Form!" +  vSelection)
	    FormExit(vCurrentForm) // Close this form
     }
 



Note: You should add a similar command button on each of your alternate forms, but include 'Aufnahme' in vAltFormList so that you can always get back to your main form.
  
Back to top
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Switch to Alternate Form
Reply #6 - May 28th, 2009 at 3:51pm
Print Post Print Post  
Hello Ben,

Your demo is very helpfull.
All the forms are in the same database.

My command starts from a different form (colled main menu)

Aufnahme is a Form with  three alternative forms.

vSelection ="Aufnahme,Chemie,Allergie,Sero"

I would like the "XResultSetOpenForm(vRS, vSelection)"  open directly  the alternate form (vSelection).

Thanks.
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: Switch to Alternate Form
Reply #7 - May 30th, 2009 at 8:07am
Print Post Print Post  
Hello Ben,

All the forms are in the same database.

My command starts from a different form (colled main menu)

Aufnahme is a Form with  three alternative forms.

vSelection ="Aufnahme,Chemie,Allergie,Sero"

I would like the "XResultSetOpenForm(vRS, vSelection)"  open directly  the alternate form (vSelection).

Thanks.
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Switch to Alternate Form
Reply #8 - Jun 1st, 2009 at 3:30pm
Print Post Print Post  
Try the following programming

Form : Aufnahme
Code
Select All
var vRS as Int
var vDatei as String
var vList as String
var vVorname as String
var vNachname as String
var vgeb as Date

vVorname = ".." + Select Vorname + ".."
vNachname = ".." + Select Nachname + ".."
vGeb	= @Str(Select Geb)

vDatei =  Select Datei ( it is OK)

vRS = @XResultSetSearch(@FN,vDatei, 0, 2,"!Nachname=" + vNachname,"!Vorname=" + vVorname,"!Geb="+ vGeb)
If @XResultSetTotal(vRS) > 0

				{
					clear(Select Nachname;Select Datei;Select Vorname;Select Geb)

 					XResultSetOpenForm(vRS, vDatei)
					XResultSetClose(vRS)
					  
				}
else
@msgBox("Diese Auswahl wurden nicht gefunden","","")
 


« Last Edit: Jun 1st, 2009 at 9:11pm by Ben »  
Back to top
IP Logged