Adding a custom view to an ACL table comes in handy when you want to 1) change the order of the fields in an ACL table, or 2) view a select number of fields.
You can add a custom view manually or via script. We’ll tackle the script version first.
This post is in response to Les’ question about reordering fields in a table.
Add Custom View via Script
Let’s assume we have a table called servers1 containing 3 fields in the order shown. Note that the table is shown in the Default_View (see yellow highlight), which is the default view of every table.
You want to reorder the fields so that Install_Date is the first field shown in the table. Here’s the script to that creates a view called Custom_View, which I wrote as a standalone script.
Please note that this does NOT change the order of the fields in the actual table; it just changes the order of the fields in a view.
When you run this script, your table will look like this, based on your new Custom_View (note that the Install_Date field is listed first):
To add this code to an existing script, you would just copy lines 6-9 to your script, and change the field names and the view name.
If the existing script hasn’t opened the table yet, you’ll need to include line 5.
A few notes about the script:
- Line 3 prevents you from getting prompts when the table is updated with the custom view
- Line 5 opens the table to which you want the custom view added.
- Line 6 defines the name of the new view (Custom_View). View names cannot contain spaces.
- Lines 7-9 add the columns (fields) to the custom view
- The OK at the end of line 6 prevents you from getting prompts when you add the custom view.
- If this is the last part of your script, the custom view will be the one that is displayed. To see the Default_View, just click the Default_View tab.
When I create computed fields, I like to create a custom view called “Computed_Fields” so that I can quickly review the field values to verify that they are accurate. That way I don’t have to scroll through the table to see the computed field values.
Add Custom View Manually
Sometimes it helps to understand what a script is doing by understanding how to do it manually. Here’s how to do the same thing step-by-step.
1. Right click on the Default_View tab at the bottom of the screen (see yellow highlights) and select New.
2. Enter a name for your view and click OK. View names cannot contain spaces.
3. Select the first field you want displayed in your table, and click the right arrow to add the field to the Selected Fields box.
4. Add the remaining fields one-by-one, and click OK. Your table will look like this:
Pretty cool, huh? Let me know what you think.
Other ACL posts:
ACL tip: What is a Computed Field?
ACL: How to Add a Computed Field
Teach Yourself ACL (most popular post on this blog)
4 responses to “ACL: Add a Custom View to a Table”
Pingback: ACL: How to Add Computed Fields via Script | ITauditSecurity
LikeLiked by 1 person
Thx! but am puzzled as to whether I can save Filtering parameters to only apply to a single View? So frustrated-not able to get a view to hold saved settings and NOT apply them globally. For ex: I have 2 views: My DEFAULT view and another called NEGATIVE_QTYS_ONLY. They mirror one another with same columns etc – but I went into the expression builder of the NEGATIVE View and set: “QUANTITY < 0" (which hid all records that are zero or greater). PROBLEM: after saving and then moving back to look at the DEFAULT VIEW, it had applied the filter there as well and I don't want that! I would like to have several views readily available without the user having to perform steps to perform filtering actions… Is this possible? If so, please expand on how… Can't find any post or Help topic that shows tab/view-specific filtering that won't force global change to the Default view… Thanks in Advance! C.
I tested this after making my first reply. I was correct; a filter applied in one view changes all views. View are for displaying all field (default view) or only specified views (a created view). An ACL view is not at all like a database view….
I typically use views only when I am adding conditional computed fields and want to see the original field and the transformed field (created by a conditional computed field). Like when I am standardizing addresses, such as changing STREET and ST. to ST.
My suggestion is to extract the table to another table. Filter the new table how you want to. The problem is that you can’t view 2 tables at once, something ACL has been asked to provide a long time ago. I’m not aware of any other apps that allow that. Even in Excel, you have to open 2 separate files to see 2 tables side by side.