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: Set the form to look at record with keyfield value of x.
Zaurusman
Posts: 44
 
Set the form to look at record with keyfield value of x.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 06 2:09 PM
fiogf49gjkf0d
With some modifications I'm doing to the Insert New Ticket form, I'm attempting to change it to, upon loading, create new record in the TICKET table and then be based on that record so that the ticket's information can be entered.

So far I've managed to create the new record, but I don't think it's successfully looking at it. Well, either that or my data grid's not working.

I've tried this, but while it doesn't generate an error I don't think it's doing what I expect it to:

frmNewTicket.CurrentID = strTicketID
frmNewTicket.Refresh
grdProducts.Refresh

strTicketID is the TICKETID of the new record I've put in the database. The first line I was hoping would move the form to that record. Is there another way in code to move to a record with a form?

Thanks in advance.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Set the form to look at record with keyfield value of x.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 06 4:20 PM
fiogf49gjkf0d
I believe you would need to use the MainView loading technique. That would give you access to the Form.CurrentID properties, which I believe are run-time readonly normally but modifyable in MainView. This is only possible in 6.2 and above of course.

An alternative would be to use the Form.Post method. Fill out the form instead of creating your record, link a control to the KeyField and populate that control with strTicketID. If the keyfield control is populated with a valid ID before calling Post, it will create the underlying record. Calling a Form.Refresh afterward will load the record into the form proper, as if you clicked OK, and clicked Edit on a parent grid.

Another alternative would be to create a keyfield then use the MainView.SetDataMode 1, "KeyField" method, which is SUPPOSED to throw a MainView into insert mode instead of edit but I've never gotten it to work correctly in 6.2. Apparently there's a ShowViewForAdd method that is supposed to address this in v7, but it doesn't seem to be documented (on top of the fact that SetDataMode isn't correctly documented either).

Personally, I'd go with method #2 as it's what I use when I need to insert items into a child grid on a newly created record. I use the technique to write the parent record to the database, the refresh rebinds the child grid, and I can then add child records without having to resort to the OK/Edit combination.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Set the form to look at record with keyfield value of x.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Nov 06 4:55 PM
fiogf49gjkf0d
Quote:
Originally posted by Jeremy Brayton

If the keyfield control is populated with a valid ID before calling Post, it will create the underlying record.

I needed to clarify this a little bit. You can use GetIDFor to populate the control.text and it will write a record using that ID. If you leave the field blank, I believe it will generate a new ID for you a la "Insert" mode but I don't believe I've ever done it or if I did it was 2-3 years ago.
[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 10:40:46 PM