Hello guys!!
I'm very new in openedge and I'm having some problems trying to create new rows. I'm using openedge 10.2b.
I've made an object to create a bindingsource and another object to create a query. I have a form with some textboxes and I use databinding to connect to my bindingsource, so I can navigate through the rows with these instructions:
If I set to true the property "autoUpdate" of the bindigsource everything works fine, but I have read that this is not the best way and when I set to false it doesn't work.
I have a button named "new" that calls a method of the bindingsource object with this instruction:
As I read, this instruction creates a row that can be undone with "cancelEdit()".
Finally, once I have edited all the fields of the form I click the "save" button that calls a method of the bindingsource object with these instructions:
I also have a "Write" trigger that calls a sequence to autoincrement ID, because I didn't find a way to assign an ID to the textbox programatically, it only works if I type the ID in the textbox manually.
There are a few fields that I have to assign programatically (without textboxes) so I use these instructions before call "NewRow" (it doesn't work with ID):
If I set "autoUpdate" to false, it fails because it doesn't find the "current" row, so I can't modify field1 and field2. If I comment these 3 lines it does nothing, no row is created.
The documentation says this about "Autoupdate":
Indicates whether the ProBindingSource object automatically updates records in the ABL data source object in response to appropriate user actions in the bound .NET control.
The default value is FALSE. Note: Intended only for rapid prototyping purposes.
My question is how can I do that manually? And is there a better way to assign autoincrement ID? When I studied .NET I used datarow to store all the fields, is there something similar in Openedge?
PD: I have read a lot documentation about bindingsource, but everywhere talks about using ultracontrols and I don't have license for that and in this case I don't want to use a grid.
I'm very new in openedge and I'm having some problems trying to create new rows. I'm using openedge 10.2b.
I've made an object to create a bindingsource and another object to create a query. I have a form with some textboxes and I use databinding to connect to my bindingsource, so I can navigate through the rows with these instructions:
Code:
BSource:MoveNext().
BSource:MovePrevious().
If I set to true the property "autoUpdate" of the bindigsource everything works fine, but I have read that this is not the best way and when I set to false it doesn't work.
I have a button named "new" that calls a method of the bindingsource object with this instruction:
Code:
BSource:AddNew().
As I read, this instruction creates a row that can be undone with "cancelEdit()".
Finally, once I have edited all the fields of the form I click the "save" button that calls a method of the bindingsource object with these instructions:
Code:
BSource:endEdit().
BSource:NewRow.
I also have a "Write" trigger that calls a sequence to autoincrement ID, because I didn't find a way to assign an ID to the textbox programatically, it only works if I type the ID in the textbox manually.
There are a few fields that I have to assign programatically (without textboxes) so I use these instructions before call "NewRow" (it doesn't work with ID):
Code:
bufferName:FIND-CURRENT (EXCLUSIVE-LOCK).
bufferName:BUFFER-FIELD ("field1"):BUFFER-VALUE () = value1.
bufferName:BUFFER-FIELD ("field2"):BUFFER-VALUE () = value2.
If I set "autoUpdate" to false, it fails because it doesn't find the "current" row, so I can't modify field1 and field2. If I comment these 3 lines it does nothing, no row is created.
The documentation says this about "Autoupdate":
Indicates whether the ProBindingSource object automatically updates records in the ABL data source object in response to appropriate user actions in the bound .NET control.
The default value is FALSE. Note: Intended only for rapid prototyping purposes.
My question is how can I do that manually? And is there a better way to assign autoincrement ID? When I studied .NET I used datarow to store all the fields, is there something similar in Openedge?
PD: I have read a lot documentation about bindingsource, but everywhere talks about using ultracontrols and I don't have license for that and in this case I don't want to use a grid.