11/26/2024 12:26:28 PM
|
|
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!
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.
|
|
|
|
How to pass parameter from one form to another form?
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? |
|
|
| |
|
Re: How to pass parameter from one form to another form?
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 |
|
|
|
Re: How to pass parameter from one form to another form?
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. |
|
|
|
Re: How to pass parameter from one form to another form?
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")
|
|
|
| |
|
Re: How to pass parameter from one form to another form?
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 |
|
|
|
Re: How to pass parameter from one form to another form?
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? |
|
|
|
Re: How to pass parameter from one form to another form?
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? |
|
|
|
Re: How to pass parameter from one form to another form?
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. |
|
|
| |
|
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!
|
|
|
|
|
|
|
|