Sync new BO record to form controls


Author
Message
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
There are two options for this:  you can forego the binding completely and just copy the data back and forth between the business object and the control whenever you need to move the data, or, you can set both the ControlSourceUpdateMode and the DataSourceUpdateMode to Never and use a reference to the binding object to push and pull the data whenever you want to move it, like this:

Me.myTextBox.DataBindings(0).ReadValue

Me.myTextBox.DataBindings(0).WriteValue

Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Also, if there were a way to manually control the BindingUpdates this would solve my problem.  There are selections for BindingUpateMode and ControlSourceUpdateMode which allow you to set when the controls/BO fields update.  If there were a selection for Manual and a method which would accomplish this, I could control when I want the UI to update and when I want the BO to update.  Is something like this possible? 
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
The user could possibly do any of these things:

1. Choose a selection template from the drop-down combo which would populate the form with the selections from the template.  Then edit and save this same template.  This one's easy, put the BO in edit mode on the drop-down selection and then save it on the save button click.

2. Open the form, edit some values, make some selections and save these changes as a new template.  This one's pretty easy too...just call a .Add on the form creation and a .Save on the save button click.

3.  Choose a template just like in the first two, except after editing some of the selections on the form, the user then changes the name of the template to something else and wants to now make this a new template. At this point I would have to switch from Edit to Add mode, but retain the selected values.  I can't think of a way to do this.  If I call an Add here it clears out the values I currently have selected.  I need to be able to navigate to a current row in a business object, put it in edit mode so i can start changing its' values.  Then, I have to be able to cancel the edit (undo), take all the values that have been changed so far and apply them towards a NEW row which I have created.  This would accomplish what I'm trying to do.

Is there any way to copy the contents of the current row to a new row or something along these lines?  I've tried using two business objects, but I guess I'm just not doing something right because I can't get it to work the way I'd like.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I guess part of my confusion is that I do not understand how you don't know if you are in Add or Edit mode.  At this point you have either loaded a record or have added a record for them to add.  You may just need to have two business object instances...would that resolve your problem?
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Here's that screenshot.
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497

I'm still not sure that I explained myself very well.  I am not trying to make a BO template.  I have attached a screenshot of the form I'm working with.  This is a form which users will eventually use to do reports.  There will be many different values(controls) on the form which the user will be able to configure however they'd like for different reports.  What I want to do is save these control values(report settings) as a template.  I do this by saving the values as a record in a BO.  My problem here is that I don't know whether the user is in Add or Edit mode until they click the save button at which point I see if they have already created this template or if it's a new one.  What I'd really like is a way to have the following scenario:

User opens the form, clicks around and makes his/her changes to the form, possibly runs a report.  Then they type in a new name for the form template they are working with and click save.  This should retrieve all values from the form's controls and save them to the BO.  If they select a template from the list it should update the controls' values to that templates values. 

I guess my issue is that I don't know whether a BO should be in Add or Edit mode until the time of the Save operation.  What I need here is a way to call either of these methods, but keep the current values of the bound controls. 

I may still not make any sense to you...I will possibly just have to make this form unbound, but I hate to lose the SF binding functionalities.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
If I were you I would just create a user control and drop the BOs on that user control and program your control to do whatever you want...your template.  Then drop this control on a form and just use the BOTranslations property to translate BO settings from one to another.  This way you have a reusable "template" that can be dropped on any form and all it needs to be updated is a BOTranslation.
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
Ok, picture this....I have a form with a bunch of controls bound to a BO.  I want to be able to create "templates" of that form which save different user settings.  So, I want the user to be able to basically get the controls set just as they want them and click save to save the template to a new record in the BO.  If I call the .Add this creates a new record for the template, but clears all the settings to defaults.  If I call a .NewRow this does the same thing.  I want to create a new row which will take all the user's current control settings and apply them to the new row.  Oh, I forgot to mention that I have IgnoreManageReadOnlyState set to True for all of these controls.  The user has to be able to use all of them without being in an edit/add state.  The only time I want the binding is for creating the settings template.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I really don't understand your question.  You mentioned the .Add() several times so I am confused as to what objects you are talking about.  Are the controls not already bound to the BO that is adding a record?  If not, then what BO are you trying to update? 
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I have a form with a bunch of controls bound to my BO.  I want to be able to call a .Add and then sync the BO with the controls as they are on the form when the .Add is called.  Is there a way for me to do this currently?  Right now, it just sets everything to defaults when I call an Add.  In this case I want it to take on the values of the current bound control settings.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search