Hi!!
I know how to update my probindingsource thanks to databinding but I would like directly update my pbs like this:
DEFINE VARIABLE rBS AS Progress.Data.BindingSource NO-UNDO.
DEFINE VARIABLE hCustQuery AS HANDLE NO-UNDO.
CREATE QUERY hCustQuery.
hCustQuery:SET-BUFFERS(BUFFER Customer:HANDLE).
hCustQuery:QUERY-PREPARE("PRESELECT EACH Customer").
hCustQuery:QUERY-OPEN.
rBS = NEW Progress.Data.BindingSource(hCustQuery).rBS:item["Customer_name"]:Value = "John".
rBS:Assign().
Is there anyway to do something like this?
Thank you
I know how to update my probindingsource thanks to databinding but I would like directly update my pbs like this:
Can you explain a bit more what/why you are trying to accomplish because that might change our suggestion.
rBS:item["Customer_name"]:Value = "John".
rBS:Assign().
The proper way WOULD be to use the InputValue object, however that's implemented in such a way that it's just read only.
> Is there anyway to do something like this?
Why don't you assign the underlying buffer value and Refresh the BindingSource?
I've got some data fields that I have to assign when I update/create a record.
These fields don't need data-bound controls like Textbox.
If I use a data-bound control, I have to make it hidden.....not really a good solution.
I've got some data fields that I have to assign when I update/create a record.
These fields don't need data-bound controls like Textbox.
In that case, I wouldn't make it a UI/view function at all. It's like you'll have to create new records on the ABL level first, I'd also assign those non UI fields, to the buffer directly.
If I use a data-bound control, I have to make it hidden.....not really a good solution.
Are you aware, that hidden controls don't activate their binding capabilities by default? You have to tweak that they really get loaded (Load event).
I'd also assign those non UI fields, to the buffer directly
I agree but How do I proceed? I don't know How to acces directly to the buffer with a BindingSource. Have you got some example?
I agree but How do I proceed? I don't know How to acces directly to the buffer with a BindingSource. Have you got some example?
That will depend a lot on what you're binding to... You can bind to
- a ProDataset (dynamic or static)
- a Query (dynamic or static)
- a buffer (dynamic or static)
In the end it all comes down to binding to a buffer, PDS and Query just offer navigation on top.
Something like this will work, if you are binding to a dynamic dataset for instance.
DEFINE VARIABLE hDataset AS HANDLE NO-UNDO.
DEFINE VARIABLE hBuffer AS HANDLE NO-UNDO.
/* Let the UI do it's job first */
bindingSource1:Assign () .
ASSIGN hDataset = bindingSource1:Handle
hBuffer = hDataset:GET-BUFFER-HANDLE ("eCustomer") /* alternative GET-BUFFER-HANDLE (1) */
hBuffer::CustNum = 42
hBuffer::SalesRep = "BBB"
.
The binding source will make sure that the right buffer is available.
Well, as a word of warning, some ProDataset methods, like GET-CHANGES or MERGE-CHANGES will invalidate the buffer position. But that usually comes after you have assigned field values.
Thank you, that's what I need!
I've got another question about creating new record but I will create new topic for this.