Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: How to pass parameter from one form to another form?
william xie
Posts: 28
 
How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 06 8:43 AM
fiogf49gjkf0d
I try to use: Application.BasicFunctions.ShowViewForRecord to open another form, and need to pass the record ID to the form which I opened, the problem is how can I get the record ID in another form?
[Reply][Quote]
william xie
Posts: 28
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 06 8:46 AM
fiogf49gjkf0d
Another question is what's the different between:
Application.BasicFunctions.ShowViewForRecord and Application.BasicFunctions.ShowViewForRecordEx?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Aug 06 10:22 AM
fiogf49gjkf0d
Since ShowViewForRecord is used to open a data form, the data form is only valid with some context. That is, a record ID, table, etc (or blank record ID for an "add"). The record ID is passed as a parameter to ShowViewForRecord (See http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=48).

When the data form is launched this way, it automatically will have the proper context for binding based on the record ID used when the form was launched.

If you need to pass other values to the form, you can use globals for that (See Application.GlobalInfo).

-Ryan
[Reply][Quote]
william xie
Posts: 28
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 9:31 AM
fiogf49gjkf0d
I read the article: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=48 but it still does not work in my case. OK, Let me explain my case in a little bit detail:

There is one course detail data form with all kinds of course related data, after the user filled in the data, he clicked the "Register Attendees" button to invoke another data form "Attendee Details", the course name and course start date should be automatically shown in "Attendee Details" form. then I need to pass the Course ID to "Attendee Details" form,

I use ShowViewForRecord C_Course_Detail, "System:Attendee_Details", course_ID to invoke the Attendee Details form, How can I get the course_ID in "Attendee_Details" form?

Does ShowViewForRecord only works for the event of datagrid?

If the data form "attendee_Details" get the foreign key: course_id, will the data of course_name and course_startDate be automatically shown there? I had bound the fileds of table to these textbox.
[Reply][Quote]
Jeff Crawford
Posts: 52
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 4:03 PM
fiogf49gjkf0d
Would something like this help you?

' Calling the next form

' Store the ID in the Global variable "FormNameRecordID"
Call Application.GlobalInfo.Add("FormNameRecordID", "x12345678900")
' Call the next form
Call Application.BasicFunctions.DoInvoke("From", "Family:FormName")

' Using the OnOpen event of the next from

' Collect the global variable
strRecordID = Application.GlobalInfo.Item("ForNameRecordID")
' Clear the global variable
Call Application.GlobalInfo.Delete("FornNameRecordID")
[Reply][Quote]
william xie
Posts: 28
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 4:30 PM
fiogf49gjkf0d
I already implemented your approach in this way. Is this the only solution?

and ShowViewForRecord is only can be used for DataGrid?
[Reply][Quote]
Jeff Crawford
Posts: 52
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 30 Aug 06 4:56 PM
fiogf49gjkf0d
ShowViewForRecord is only can be used for DataGrid?
No. It can be used to call any bound "Data Form". "Manage Forms" will not work with this function.

Is this the only solution?
For PrimaryKeys, no it's not. However, for other parameter values, it's one of the only methods available. If you use ShowViewForRecord, you should be able to use FormName.CurrentID to get the Primary Key, although I haven't tested that. Another method would be to bind an object to the Primary key on your form you're calling, make the object invisible, and reference the object after the form has been opened.

~JC
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Aug 06 8:08 PM
fiogf49gjkf0d
If your form you want to launch is a Data form (has a base table), then ShowViewForRecord is the only way. It doesn't matter if it is launching from a datagrid or not, if it is a data form then it need's a primary ID to give it context to know which record to bind to.

If your form is a manage form, then it does not have a base table and no binding. For a manage form you cannot use ShowViewForRecord and must use DoInvoke instead.

Make sense?
[Reply][Quote]
william xie
Posts: 28
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Aug 06 9:13 PM
fiogf49gjkf0d
Unfortunately it still not work in this way. In my case, the open data form has one primary key and one foreign key. Although it is the new data form, I still need to pass the foreign key to this form.

Does it mean in this scenario, the ShowViewForRecord does not work? I should use: ShowViewForRecordEx?

Strange enough is: ShowViewForRecordEx "C_Attendee", "System:C_Attend_information", "", "C_Attendee:CourseID", strCourseID

not work, but I can see: ShowViewForRecordEx "C_Attendee", "System:C_Attend_information", "", "C_Attendee:CourseID", "CourseID" can make the string "CourseID" to passed to the dataform C_Attend_information in the change event. That is not what I needed. But at least I can see some value has been passed to my new data form, why the strCourseID cannot be passed?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 31 Aug 06 10:16 PM
fiogf49gjkf0d
Launch the form with ShowViewForRecord normally, but before calling ShowViewForRecord, set the foreign key value CourseID as a global (using Application.GlobalInfo) and then retrieve it from the form once opened (again using Application.GlobalInfo). Give that a try.
[Reply][Quote]
william xie
Posts: 28
 
Re: How to pass parameter from one form to another form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 01 Sep 06 8:52 AM
fiogf49gjkf0d
I had maken it work by using Application.GlobalInfo. But I think ShowViewForRecord is better, the problem is I cannot make ShowViewForRecord work in this case. Anyway, Thanks, Ryan!
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 12:26:12 PM