Skip to main content

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 Mon, 07/27/2015 - 08:25

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 Mon, 07/27/2015 - 09:49

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 Mon, 07/27/2015 - 10:04

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 Tue, 07/28/2015 - 00:49

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

KrisW Wed, 10/26/2016 - 11:06

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 Wed, 10/26/2016 - 11:23

In reply to by KrisW

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