Normal Topic @CreateNewRecord() (Read 636 times)
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
@CreateNewRecord()
Dec 4th, 2005 at 2:50pm
Print Post Print Post  
I know that @CreateNewRecord() can be used to add a new record to the current form. But, is there a way to add a new subrecord to a table view subform, from within the parent form?

I have a command button that launches a picklist that is used to fill an element in the lineitem row that last had focus before clicking on the button in the parent form. This works very well as is, but one drawback is that I need to first go to the subform and "arrow down" or press F10 to make a new line at the bottom of the lineitem rows. Then I click on the button in the parent form to bring up the picklist of items that will autofill the new subrecord.

I would like to automatically have the programming add a new subrecord each time I make a selection from the picklist. This would streamline the process tremendously. (I already used to launch the picklist from within the subform programming, but that caused other issues.)

If there is no way to do this now, I would like to suggest that a future release might have the ability to use something like:
@CreateNewRecord("MySubform") or @FormCreateNewRecord("MySubform").
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @CreateNewRecord()
Reply #1 - Dec 4th, 2005 at 3:12pm
Print Post Print Post  
@FormNewRecord(FormName as string) as int
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: @CreateNewRecord()
Reply #2 - Dec 4th, 2005 at 9:10pm
Print Post Print Post  
Thank you so much, Mark. I was surprised when I didn't find a function for that purpose, because I figured that you would have already provided a way to do that. But, of course, you did. Roll Eyes

I can't believe that I overlooked it, since it appears on the same page in the programming guide as @CreateNewRecord. Embarrassed

I guess I was fixated on the idea that the function would have "Create" somewhere in its name. I kept running searches for the word "Create", but the description for that function just states, "Adds a new record...".

Anyway, thanks again for pointing it out.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @CreateNewRecord()
Reply #3 - Dec 4th, 2005 at 9:21pm
Print Post Print Post  
Quote:
I guess I was fixated on the idea that the function would have "Create" somewhere in its name. I kept running searches for the word "Create", but the description for that function just states, "Adds a new record...".


Behind the scenes story: @CreateNewRecord was originally named @NewRecord. Probably because in C++ (the computer language Sesame is written in), "new" is a command that makes a new object. For example to make a new record in Sesame source code, one would write:
Code
Select All
  Record *rec = new Record();
 


Anyways, it was decided that that was not clear enough, or that it might interfere with field names, LE names, or variable names - so it was changed to include the verb "Make". I guess that @FormNewRecord wasn't renamed at the same time.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: @CreateNewRecord()
Reply #4 - Dec 4th, 2005 at 9:50pm
Print Post Print Post  
Quote:
so it was changed to include the verb "Make".

You meant the verb "Create", didn't you?

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: @CreateNewRecord()
Reply #5 - Dec 4th, 2005 at 9:53pm
Print Post Print Post  
Indeed I did. Thanks.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged