| | Business Component on form | |
|
Description
To insert a BC in a form, you must define a variable of the new type associated to the TRN, and this variable is inserted in the form as any other variable, through the Insert/Variable menu, or through the Pallete Toolbar shortcuts. In the first case, the following dialog is displayed when selecting the variable:
In the second case, on selecting one (or more) BC type variable(s), the Control Name and Field Specifier options are enabled in the dialog showing the different SDT elements in a combo where you can select the one that you want to show in the form.
If you select a BC with several levels, they will remain in a grid.
Example in a Work Panel:
Example in a Web Panel:
This simplifies the code required to edit, modify or insert the records of a BC.
E.g.: with the previously defined forms, the following events will be enough to execute the actions mentioned above on a record:
Event 'Save' &Invoice.Save() do "error handling" if &Invoice.Fail() rollback else commit endif EndEvent // 'Save'
Event 'Get' &Invoice.Load(&Invoice.InvNbr) do "error handling" EndEvent // 'Get'
Event 'AddLine' &InvoiceItem = new Invoice.InvoiceLevel1Item() &Invoice.InvoiceLevel1.add(&InvoiceItem) EndEvent // 'AddLine'
Event 'Delete' &Invoice.Delete() do "error handling" if &Invoice.Fail() rollback else commit endif EndEvent // 'Delete'
sub "error handling" &Messages=&Invoice.GetMessages() for &Message in &Messages msg(&Message.Id) msg(&Message.Description) endfor endsub
Besides, the CurrentItem property has been added for those SDTs defined as Collection, which allows displaying the members of a collection.
E.g.: in case of an Invoices BC, to display the name of the product appearing on the selected line you can use the following event:
Event 'Selection' &msg = str(&Invoice.InvoiceLevel1.CurrentItem.ProdPrice) msg(&msg) EndEvent
If you are working with a Web model, you must setup the AllowSelection = True grid property to be able to select the line to be displayed.
Note: When using Bc on form (Win or Web) , the Client Side Validation (CSV) is not triggered.
|
| | | | | | 2281 | | Created: 12/28/05 02:12 PM by jlarrosa Last update: 03/12/09 09:33 PM by acardoso | | |
|
| |
|