Title: More than one layout tags refer to the same field Post by: Snorri B. on August 28, 2009, 01:35:22 pm Hi.
I'm in the process of modernizing a legacy program which uses 16 forms and 10 different INPUT BY NAME. These forms have many fields in common and ultimately the data is inserted in the same tebles(s). My goal it to simplify this and throw out redundant code by creating one paged form and one input by name block. Then I want to hide all pages except the one relevant to the type of input. By creating one input by name block I can have one before/after field block for a field that appears on all the forms (instead of 10 now)!. My problem is this: Some fields appear on all the forms, some on 6, others on 8 etc. It is impossible to hide the fields not relevant because it would make the resulting form too big, visually unpleasing and with too much unused space in it. So what would be useful if I could put the same field multiple times on the same form. Example: LAYOUT ( TEXT = "Customer orders" ) 02 VBOX 03 GROUP group1 ( TEXT = "Customer" ) 04 GRID 05 { 06 <G Common_fields > 07 [f001 |f010 ] 08 < > 13 } 14 END 15 END 25 FOLDER 26 PAGE pg1 ( TEXT = "Address" ) 27 GRID 28 { 29 Address: [f011 ] 30 State: [f012 ] 31 Zip Code: [f013 ] 32 } 33 END 34 END 35 PAGE pg2 ( TEXT = "Comments" ) 36 GRID 37 { 38 Name: [fname ] ZIP: [nzip] 42 } 43 END 44 END 45 END 46 END 47 END attributes .... edit f011=formonly.adress edit f013,nzip = formonly.zip .... In the example above, the zip field has two references in the form, f013 and nzip. If I would hide page pg1 the zip field would be visible on pg2. BEFORE/AFTER FIELD zip code would work for "both" fields. In my case, the same field would be for exapmle on pages 1,4,7,8 but not on the other pages (2,3,5,6 etc). This way I could layout my form more easily than having to hide/show fields. Does this make sense, or is there another way to achieve this? (I know I could create the form manually via DOM etc. but placing the fields in the right positions can be rather difficult :-)) Best regs, -Snorri Title: Re: More than one layout tags refer to the same field Post by: Reuben B. on August 31, 2009, 04:16:27 am My first thought is that if you will probably end up with 1 INPUT block but 16 forms.
What I have is some suggestions that would reduce the code duplicaton in the 16 forms. Have a look at a column values file https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/DatabaseSchema.html#VAL_FILE I haven't used it myself and haven't seen it in use by any of my local clients but as I understand it you would only have to define the field in the attributes sections like so... f01 = customer.zipcode; and at compile time all the attributes will be read from the .val file. This means that if you change the attributes for a field, you would only have to change them in one place, the .val file and recompile your forms. The second thing is have a look at the experimental form layout style in the 2.20 gdc https://4js.com/techdocs/genero/gdc/devel/DocRoot/User/NewFeatures.html#220FormLayout THis would mean you wouldn't have to spend too much time laying out the form, just say what you want in each group and its relative positioning and the run-time will do the rest. It also allows you to specify the TITLE attribute for a non-column field. So you'd end up with forms like LAYOUT GRID { [f01 ] [f02 ] } END END f01 = customer.customer_number; f02 = customer.zip_code; LAYOUT GRID { [f01 ] [f02 ] [f03 ] } END END f01 = customer.customer_number; f02 = customer.address; f03 = customer.zip_code; and in your .val file customer^customer_number^TITLE^"Customer Code"^ customer^address^TITLE^"Address"^ customer^zip_code^TITLE^"Zip Code"^ Hope that helps, Reuben Title: Re: More than one layout tags refer to the same field Post by: Snorri B. on August 31, 2009, 12:30:00 pm Hi Reuben and thanks.
In our application the user can browse through detail records (next/previous) and depending on the type of data the corresponding form is shown. Currently this is achieved by closing the window and re-opening it with a different form. This means that you might need to close/open window everytime the user presses next/prev. By having this in one form you can show/hide folderpages (or groups) with relevant data. This is much more pleasing to the eye and much faster. Best regards, -Snorri Title: Re: More than one layout tags refer to the same field Post by: Sebastien F. on September 11, 2009, 12:30:54 pm Regarding the .val schema file usage, if you don't specify a form item type like in:
f01 = table.column; It will default to an EDIT. You need to use FIELD to get the widget defined in the .val file: https://4js.com/techdocs/genero/fgl/devel/DocRoot/User/FormSpecFiles.html#FF_ITEMTYPE_FIELD You may also want to look at this demo tool: FGLDIR/demo/Tools/fglcaed Seb |