Hide a column programmatically

7 posts / 0 new
Last post
mohamed
Offline
Joined: 07/27/2015 - 03:45
Hide a column programmatically

Hi,
I have to hide a column which is used for internal calculations. This column will be created from code and should not be visible to user by default.
I am using TableManagementLib.TableManagement to append field. I don't see any attribute in COMDBLib.Field interface for setting visible property.
Is there any work around for this?
Thanks,
Shafeer
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hello Shafeer and welcome to the site.

There is no way to do this using the TableManagement library.  The way to get around this is to create a view hiding the column and then use the Client.OpenView "MyView.VW2" to hide it.  The problem is now you have two files to distribute and you should add code to make sure that the file exists or that there are no errors (the user added or renamed fields to the file) when you open the view.

Hope this helps out.

Brian

mohamed
Offline
Joined: 07/27/2015 - 03:45

Hi Brian,
Thanks for your quick response.
Unfortunately we cannot propose a solution with 2 files because user will be using the file shown in UI for some other activities. In that case that file will not have the 'hidden' column which will be required for further processing.
Thanks,
Shafeer

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Shafeer,

Unfortunately there is no way that I know of to do it without using the view, so they will see the column.  If you don't want them to make changes to it you can create it as an "IDEA" field instead of a virtual field.

Good luck in your project.

Brian

mohamed
Offline
Joined: 07/27/2015 - 03:45

Hi Brian,
Our objective is that column should not be visible to user.
Thanks,
Shafeer

KrisW
Offline
Joined: 02/16/2015 - 13:38

Do not know how (still learning), but would setting the column properties to 1 pixel & nowrap sufficiently "hide" it?
Is it possible to change these settings programmatically?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Kris,

Unfortunately there is no way that I have ever found to change the fields programmatically.  The best I have been able to do is create a view and call the view from the script.

There is an option to hide a field but a user can always have access to it and unhide the field.  There is no way to protect portions of an IDEA file with a password like there is in Excel.  If you don't want the user to see the field then the best way is to perform an extract of the entire file except for that field and give that file to the user instead of the original.

Brian