Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, June 19, 2025 
 
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: Finding the ID a data form will use when inserting data into a custom table before it saves.
RJ Palombo
Posts: 43
 
Finding the ID a data form will use when inserting data into a custom table before it saves.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 1:00 PM
I really didn't have a problem with this on a managed form being I could generate it's own ID, but this form has so many fields that I would hate to have to use SQL statements to insert and edit all the values.

I'm just trying to find the ID that my dataform will use when it inserts data to the custom table. The reason for this is I have embedded datagridds that obviously will not know where to bind it's data there for leaving unlinked records in the datagrids tables. Anyone run into this?

I've tried application.BasicFunctions.CurrentViewID with no luck as it seams to not know an ID at that current time. Only when I save and reopen the form does it display the currentviewid.

Frustrating....

Actually I just had an idea... Could I possible bypass the dataforms id that's generated with a basic GetIDFor("MYTABLE") and create a hidden field that inserts the table id?...
[Reply][Quote]
RJ Palombo
Posts: 43
 
Re: Finding the ID a data form will use when inserting data into a custom table before it saves.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 1:31 PM
To my suprise this works. My only problem now is invoking the GetIDFor at runtime.
[Reply][Quote]
RJ Palombo
Posts: 43
 
Re: Finding the ID a data form will use when inserting data into a custom table before it saves.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 1:34 PM
Okay, nevermind! The OnShow obviously is the action I needed to use. Hopefully someone can use this
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Finding the ID a data form will use when inserting data into a custom table before it saves.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 2:09 PM
Hehe. Nice little conversation you're having here

As you've found, you can stick a hidden label on a form, bind it to the ID field, then create your own ID and place it there. Then when the form saves it will use that as the ID for the data, instead of create a new ID value.

However, you'll want to use the form's OnChange method to create the new ID and place it in your hidden label instead of the OnShow. This will make it much more reliable as the Change fires whenever the form receives new data context for an add or edit.
[Reply][Quote]
RJ Palombo
Posts: 43
 
Re: Finding the ID a data form will use when inserting data into a custom table before it saves.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Jul 07 2:20 PM
Thanks for the reply

Wouldn't the OnChange cause the form to generate a new ID each time?

This is what I did to stop the field from generating a new ID each time and it's working great. Please let me know if I missed something

Sub AXFormShow(Sender)
If application.BasicFunctions.CurrentViewID = "" Then
'Basically if this is a new sale then generate an ID for the Sale, tracking, and repeat mailing tables
saleid.Text = application.BasicFunctions.GetIDFor("PP_SALE")
TrackingDG.BindID = saleid.Text
MailingDG.BindID = saleid.Text
Else
'Since the sale is already there, let the IDs populate from the table
End If
End Sub
[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Finding the ID a data form will use when inserting data into a custom table before it saves.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Jul 07 8:48 AM
Absolutely NOT.

The ID is generated on the OK Validated Close (it isn't generated on a Cancel) of the form.

You can do something like

SUB AXFORMCHANGE(Sender) ' This is NOT on the Open, not on the Form Show, CAPICHE?!
DIM TheFormID

IF application.basicfunctions.currenviewID = "" THEN
TheFormID = Application.basicfunctions.getIDFOR("AardVark_Table")
txtFormKeyID.TEXT = TheFormID
ELSE
TheFormID = txtFormKeyID.TEXT
END IF

END SUB
[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 © 2025 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): 6/19/2025 10:28:07 AM