hide columns in a grid widget uniface 9.6

Author: ivanandradesantana@gmail.com (IvanSantana)

Hi I'm developing an application where I am using a grid widget, and need to create a column hid, and not want to show on screen. How can I do this.

13 Comments

  1. In the grid widget properties, Use the MORE button, add a property of "VISIBLE" with the value as a Gold-; separated list as below :- FIELD_NAME1=F;FIELD_NAME2=F Note, all the data in this property must be in caps.  You can set this property from proc in $entityproperties as long as the form has not yet had a show/edit/display.  The downside of using this is that the field to the 'left' of the hidden field in the grid cannot be extended to the right by the user. Also, if you change the order of the fields in the grid, or switch a column on or off programatically, one of the columns shown will be available, and extendable but will start at 0 width, so it's best to include a  putitem/id $entityproperties(v_grident),"KEEPLAYOUT","F" to ensure the columns are reset to defined sizes every time.  Although you can replace the $entityproperties() , "VISIBLE" above with $columnsyntax in version 9.5/9.6 there remains no way of defining an unmodeled field as hidden by default leaving you to either continue to use "VISIBLE" in the grid widget properties dialog, or to create non-database modeled entities in which you can define data you need but won't show. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  2. Hi Iain, great hint !! Do you know from what version the VISIBLE is supported ? Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  3. Well, at least 9.3. I don't think we ever used 9.2/9.1 and I'm not sure the grid was available in 8. 


    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  4. FiresongKt said In the grid widget properties, Use the MORE button, add a property of "VISIBLE" with the value as a Gold-; separated list as below :- FIELD_NAME1=F;FIELD_NAME2=F Note, all the data in this property must be in caps.  You can set this property from proc in $entityproperties as long as the form has not yet had a show/edit/display.  The downside of using this is that the field to the 'left' of the hidden field in the grid cannot be extended to the right by the user. Also, if you change the order of the fields in the grid, or switch a column on or off programatically, one of the columns shown will be available, and extendable but will start at 0 width, so it's best to include a  putitem/id $entityproperties(v_grident),"KEEPLAYOUT","F" to ensure the columns are reset to defined sizes every time.  Although you can replace the $entityproperties() , "VISIBLE" above with $columnsyntax in version 9.5/9.6 there remains no way of defining an unmodeled field as hidden by default leaving you to either continue to use "VISIBLE" in the grid widget properties dialog, or to create non-database modeled entities in which you can define data you need but won't show. 

    Thanks FiresongKt.   I did the test and it workedLaugh


    Author: IvanSantana (ivanandradesantana@gmail.com)
  5. IvanSantana said hi Eddy, thanks for the post ... but I'm using a field 'no database' and I'm creating as 'hid'. In the 'grid' field does not appear, but a column for the field is created. I wanted to know if you have as the 'grid' does not create the column for this field.

    Hi Ivan, It sounds like you are using the $fieldsyntax function, or maybe the field syntax definition in the Model. When you use that a column filled with hidden fields appears. You should use $columnsyntax function. When you use that the whole column will disappear. Database or No Database is not relevant. Regards, Theo Neeskens


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  6. Hi guys ... I tested the '$ columnsyntax' function, and it did not work. I wonder if this feature works in version 9.3 or higher versions only. Because I'm in the process of migration to version 9.6 and I'm doing this test in version 9.3.


    Author: IvanSantana (ivanandradesantana@gmail.com)
  7. Hi. I'm using $columnsyntax on Uniface 9.6.04 and it works.


    Author: ezioze (ezioze@aruba.it)
  8. hi Guys, The function $columnsyntax is introduced in Uniface version 9.5.01. In the latest Uniface Library Help there is sometimes for functions and statements a section/table called 'History'. Which explains in which version of Uniface this function or statement was introduced. Hopefully this will explain your Uniface version problem. Regards, Arno Bonke


    Author: Arno Bonke (arno.bonke@uniface.com)
  9. thanks guys. I am grateful for the help. Now I know how to solve my problem, but I have to wait until the migration to 9.6 here in the company.


    Author: IvanSantana (ivanandradesantana@gmail.com)
  10. Have you seen the sample on the grid that is on this site? According to the description, it shows how to hide a column..


    Author: Adrian Gosbell (adrian.gosbell@synapse-i.jp)
  11. IvanSantana said hi Eddy, thanks for the post ... but I'm using a field 'no database' and I'm creating as 'hid'. In the 'grid' field does not appear, but a column for the field is created. I wanted to know if you have as the 'grid' does not create the column for this field.

    Hi Ivan, I mainly use the grid widget as a display only widget, i.e. not for database persistent entities.  The real data can be supplied from a service layer component, or via manual data retrieval using the real DB entities on the current form (i.e. painted anywhere on the form outside of the display grid entity, no fields painted).  So all the fields in the grid are non-database.  I tried making one of them have syntax=HID.  I used  $columnsyntax(FIELDNAME)="HID" on that field, before the edit statement in the EXEC trigger.  This works fine, regardless of the actual field Syntax setting. Are you saying that $columnsyntax doesn't work?  If so, does adding a show statement after $columnsyntax make any difference?


    Author: Eddy Knochs (eknochs@ozemail.com.au)
  12. hi Eddy, thanks for the post ... but I'm using a field 'no database' and I'm creating as 'hid'. In the 'grid' field does not appear, but a column for the field is created. I wanted to know if you have as the 'grid' does not create the column for this field.


    Author: IvanSantana (ivanandradesantana@gmail.com)
  13. Hi Ivan, If you never want to see the field, don't paint it, but if you want to switch between visible and hidden, you can do this dynamically with $columnsyntax(FIELDNAME)="HID".  Setting the value to "" reveals the column again.  $fieldsyntax operates on the current occurence.


    Author: Eddy Knochs (eknochs@ozemail.com.au)