StrataFrame Forum

Parent-Child / childformdialog - cannot add record on child form of a child form...

http://forum.strataframe.net/Topic31361.aspx

By Fabian R Silva, - - 8/13/2012

I have an "invoice form" that shows 3 labels with 3 buttons, the labels are totals of the "paymentsBO" grouped by a "TYPE" (credit/debit/cash)
when I press any of the 3 buttons, I call a child form (via a childform.showdialog). on this called form ("payments") I show a listview filtered by type (can have more than 1 record by type)
this listview via childform automation can call "add/edit/delete" that via automated childform have to call a "1-record" form

the structure is something like that:

INVOICE FORM
  content:
  INVOICE BO (parent of payments)
  PAYMENTS BO (CHILD OF INVOICE BO)
   
  - the invoice form shows 3 labels with the sum/total amounts of cash/credit/debit payment types
  - the invoice form have 3 buttons near each sum label to call the child form (via childformdialog)

Child form with listview grids will use the same BO with a filter:
  can be called with a paramt that:
  PAYMENTS BO - FILTER: TYPE=PAYMENTS_DEBIT
  PAYMENTS BO - FILTER: TYPE=PAYMENTS_CREDIT
  PAYMENTS BO - FILTER: TYPE=Ct chASH

  - the child form with listview contains a grouped listview with add/edit/delete button and child form relationship that can add, edit or delete automatically
  - if press a button from listview automation, the child form called is a "1-record" child form called from child form dialog automation

--------------------------------------------------------------------------

I not filtered the listview from the invoice yet, still the problem is that I defined two chained child form dialogs (from invoice to payment form with listview grid and from that listview to 1-record payment) 
I adding a invoice and calling some of the 3 button for payments......  (do the same each one still not filtering....)
The listview called from the invoice shows, but when I like to call the 1-record form with the "add" button, the "1-record" form shows all binded controls disabled. (it not calls the add method on paymentsBO?)

I edited the "grid/listview paments child form" payments BO to have an automatic snapshow key that differs from the invoice paymentsBO key, but this not changed anything, I not sure what is the best thing I can do to have this working ok. (I have to manually call the child form copyng data without child form dialog and control events /data by myself?)

in resume. please help me to determine what is the best approach to:
- have a "main form" (invoice) with not binded controls on the business Object "Payments BO" (that is used to show labels of sum of records based on a type column) 
   - on the invoice form, the form have 3 buttons that call a grid with filtered records by "type" column on payments BO (not filtering yet, assume that not filter occurs)
- that grid/listview form payments form have to call another form to add/edit/delete 1 record of that filtered type  (and this not be disabled, have to add the record when go back to grid show it)

If to be better understand need a sample (can use the order/orderitems stratasample....) I will do it to show the problem.

thanks in advance.
By Edhy Rijo - 8/13/2012

Hi Fabian,

I don't quite understand the whole problem here, but be careful on how you use Filters or Sort in the BO since when you adding a record on a filtered BO and the new record does not have the condition to be filtered it will not show up in the BO.

So if you are filtering your records by a PaymentType, then you add a new record with no PaymentType, then the record will be added to the BO, but it will not be part of the filtered view.

If I misunderstood you, then please provide a simple sample in VB if possible so I can help you out.
By Fabian R Silva, - - 8/13/2012

thanks for reply! forget the filter... I still without implementing it have a problem

I have a form with 2 BOs, one of them not have binded controls, and can call a form with a listview, that form listview call a 1-record editing form,

the main form call the listview form via a childformdialog.showdialog manually
the listview form call the 1-record form automatically via listview childformdialog object and add button
the 1-record form have to show controls in edit mode, but show like idle mode (all disabled)

I will try to make a example with strataframesample database to be understand

Edhy Rijo (8/13/2012)
Hi Fabian,

I don't quite understand the whole problem here, but be careful on how you use Filters or Sort in the BO since when you adding a record on a filtered BO and the new record does not have the condition to be filtered it will not show up in the BO.

So if you are filtering your records by a PaymentType, then you add a new record with no PaymentType, then the record will be added to the BO, but it will not be part of the filtered view.

If I misunderstood you, then please provide a simple sample in VB if possible so I can help you out.
By Edhy Rijo - 8/13/2012

Fabian R Silva, - (8/13/2012)
...the listview form call the 1-record form automatically via listview childformdialog object and add button
the 1-record form have to show controls in edit mode, but show like idle mode (all disabled)


Well, again, that is a bit weird "show controls in edit mode but like idle mode".  If you are using the standard SF ListView automation, it will take care of setting the BO.EditingState to Adding or Editing based on the button clicked, so are you Adding a new record or Editing?  Also again, if you are using any type of filter in the BO while or after adding a record it will not show the new record unless this record meet the condition of the BO.Filter.

A sample will be best to illustrate or duplicate your condition.
By Govinda Berrio - 10/12/2012

Hi all, 

I think I am running in to the same problem as Fabian. I have a form, from which I launch a ChildFormDialog child form. It maps to BO1 on the parent form. On the child form I show a ListView displaying mapped_BO1. I have also setup SF automation on the ListView so that I can add/edit/delete lines using ANOTHER ChildFormDialog. But the automation does not seem to work properly. When adding a new record, the second level child dialog comes up with disabled controls and based on some debugging it seems that the mapped_BO.Add() method never gets called. 

Does this sound right Fabian?

I'll try to create a sample project for this. 

Govinda
By Govinda Berrio - 10/12/2012

Hello All, 

I found a way to work around this. Most likely what is happening is that the BO object on the child form is getting overwritten and invalidating the BO that is referenced by the ListView. 
What I did to get the automation working again was I updated the reference to the BO in the form_load event.  This seemed to get everything working again.
void Form_Load(sender, object)
{
   this.lvLines.BusinessObject = this.mapped_BO1
}