Normal Topic Populating from one layout to another? (Read 810 times)
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Populating from one layout to another?
Jun 6th, 2006 at 4:29pm
Print Post Print Post  
I have a Work Request Form, and a seperate Work Order form in the same database, I want to be able to pull up a Work Request and press a command button and have the work order form load and populate several fields from the work request form, I have the command button and it pulls up the work order form but I haven't figured out the best way to have it populate the elements on the work order form.

Any idea's and help much appreciated !!!
Poppy
  
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Populating from one layout to another?
Reply #1 - Jun 6th, 2006 at 5:49pm
Print Post Print Post  
Hello Proud Poppy,

The following code can populate several fields from the work request form as you need it to.
You will need to change the paths in @FormResultSetTotal, @SelectTreeItem, and FormFieldValue to reflect the structure of your application.

Code
Select All
var vCheckOpen as int
var vSetElementData as string
Var vTree as Int

	// Set the variable data
	vSetElementData = First

	// Check to see whether the form is open in Add Data
	vCheckOpen = @FormResultSetTotal("Database!Form:(add)")

If vCheckOpen = -1 then
	{
		// Open The Form
		vTree = @SelectTreeItem("Application Title!Forms!Add Data!Database!Form")

		// Place variable data into the form. Repeat this section for each element you are populating.
		FormFieldValue("Form:(Add)","Field Name", -1, vSetElementData)
	}
Else
	{
		@MSGBox("Action failed because the target form is open in add data mode.","","")
	} 



-Ben
  
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Populating from one layout to another?
Reply #2 - Jun 6th, 2006 at 7:56pm
Print Post Print Post  
Ben,

      In the following line of code, what is telling sesame which elements in the Work Request form is to be put in the masterwo form elements ?

// Place variable data into the form. Repeat this section for each element you are populating.
   
FormFieldValue("Form:(Add)","Field Name", -1, vSetElementData)

Say the problem field in the request form needs to populate the Work Requested element in the work order form, I don't see how its telling sesame where to put the contents of the problem element in the Work_Request Form ??

Does the code go in the command button?? Are in each element that needs to go to the Work Order Form??
  
Back to top
 
IP Logged
 
Ben
Lantica Support
*****
Offline



Posts: 218
Joined: Apr 7th, 2005
Re: Populating from one layout to another?
Reply #3 - Jun 6th, 2006 at 8:20pm
Print Post Print Post  
ProudPoppy,

I apologize for not being as clear as I could have been in my instructions.

Below is the line that should be able to: enter the Work Order form, go to your Work Requested field, and enter the contents of the Problem field. You will need to replace the section in the code from the previous post with this new programming.

The code should be run from a command button on the form you wish to copy the data from.

           
Code
Select All
// Place variable data into the form. Repeat this section for each element you are populating.
		FormFieldValue("work order:(Add)","Work Requested", -1, problem) 



-Ben
  
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Populating from one layout to another?
Reply #4 - Jun 6th, 2006 at 8:42pm
Print Post Print Post  
Cheesy Cheesy Cheesy

Thanks Ben !!!!
  
Back to top
 
IP Logged