Hi, I have a grid with a form binded to it. Both shows up the same record of a table. I want to create a new record in the grid, fill in the values in the grids new record and in the fields of the form. After having done this I will save them together because it is one record. The ID is managed by the database via sequence. I mangaed to create a "create-Button" in a header-region, but failed to save the form. I think the matter is, that the form needs the primary key what is not known when saving the grids record. How can I get this to work?

thanks in advance

Eveline

asked 14 Jan '15, 05:50

Eveline%20Merches's gravatar image

Eveline Merches
2731213
accept rate: 3%


Technically what you are doing is not supported. You should define all form items within one form and use a custom override procedure to process the data. The grid should be read only which loads the form on row selection.

The problem with your proposed design is that it is split into separate transactions i.e. grid performs the insert first then the form needs to update the same record. If the grid save succeeds but the form save fails then the end user may have an undesired result.

It is however possible to alter your test case so that a form and editable grid can be based on the same table i.e. to perform the grid save, followed by an update of the form. I have copied your test case to page 4000 to provide an example. To have this work for the create operation the following steps need to be performed:

  1. Edit the hidden form primary key page item P4000_ANF_ID protection to "No". We do this to avoid checksum issues as we changethe value in the browser via javascript.
  2. Add a new "ADD" button the grid with the Database Action "SQL Insert". (We need to provide an enhancement to allow you to add rows via a dynamic action) therefore you cannot add a row via a button that is not assigned to the grid region.
  3. Create a new dynamic action to listen to the grid Create Success event to set P4000_ANF_ID page item value with the ANF_ID value from the grid using the "FOEX Grid Row Select Set Page Items" action. This is so the form knows what record to update and also so the form knows to do an update because the primary key is set.
  4. Make sure your single save button has "Wait fo Result" checked on the Grid Save action. This is to make sure we have performed the insert via the grid before performing the form update.
  5. Change the form action from "Create or Update" to just "Update" since the grid is responsible for the actual record insertion into the table.
  6. (Important) you need to change your grid query so that the record is queryable after insertion i.e. since you join several tables together in the view, they need to be outer joined to cater for NULL values since just an insert into the grid table does not satisfy the view join conditions. This is because the plugin will requery the row before/after insertion. If it does not find the row it will raise an exception.
  7. You need to add "fxIgnoreMd5Check":true to the FORM additional config since we will be performing an actual update when we create the record, but the md5 checksum will be incorrect on update since it wasn't calculated as the record didn't exist. Note: if you wish to re-enable MD5 support you need to completely remove this attribute from the additional config. Setting to false is not enough.

Please check page 4000, but please also understand design choices like this particular one will increase development time and may still not provide you with the end result you need. With that said we are interested in understanding your requirements from a forms perspective and determining whether we can accommodate these in a future version of the framework.

link

answered 14 Jan '15, 15:41

Matt%20Nolan's gravatar image

Matt Nolan
11.7k1410
accept rate: 45%

edited 18 Jan, 05:24

FOEX-SUPPORT's gravatar image

FOEX-SUPPORT
3.0k14

Please provide a test case of what you have done so far on demo.tryfoexnow.com and we will have a look at your setup.

link

answered 14 Jan '15, 07:46

Matt%20Nolan's gravatar image

Matt Nolan
11.7k1410
accept rate: 45%

In FX_WS_10 , Application 168, Page 40 I have created a button to save grid and form ("Alles speichern") and a button ("neuer Datensatz") which should create an new, empty record. Both buttons are in the header region on the left side.

Eveline

link

answered 14 Jan '15, 07:58

Eveline%20Merches's gravatar image

Eveline Merches
2731213
accept rate: 3%

Hi Mat,

thanks a lot for this detailed answer. I will comprehend this within my page. I understand that I shall not design my productive solution with that. My customers want to have a very similar application as they have now with forms. If there are to many steps to do their work with the new application they will complain. So I try to hold my solutions as near to my forms-application as possible. In the moment I try out many things and I am not building the productive application. So it doesn't matter when my requirements are not incorporated promptly or if I must look for other solutions. I will try to manage my tasks as flexible as possible, but first I try to get 100% (sorry for that!).

best regards Eveline

link

answered 15 Jan '15, 04:30

Eveline%20Merches's gravatar image

Eveline Merches
2731213
accept rate: 3%

Ok thanks for the info and no need to apologize.

We intend to help you as much as possible and get as close as possible to forms in some cases which may require enhancements to the framework. In this situation we then need to prioritize whats important or has benefit for everyone and balancing this against timing/cost/urgency etc.

(15 Jan '15, 04:56) Matt Nolan Matt%20Nolan's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×487
×122
×1

Asked: 14 Jan '15, 05:50

Seen: 730 times

Last updated: 18 Jan, 05:24

FOEX Links