Jump to content

How to copy calculated column as a static value column


David Jones 5

Recommended Posts

I have a series of parameters with yes/no drop-downs that are linked to document properties. The user selects yes for the parameters they'd like to include in a calculated column. The calculated column concatenates all the "yes" selections together. the problem I'm having is the calculated column updates every time a parameter is updated. So if the end user wants to update 10 different parameters, the calculation is performed after every change- and this takes awhile. I would like for the user to make all their changes, then click a button to update the calculated column a single time.

I've managed to do this a couple of ways, but neither are ideal. Both use IronPython.

The first idea does the following:

 

(deletes calc column) only run after first time being created

creates calc column

duplicates calc column resulting in a static column (what I'm wanting). called calc column (2)

delete calc column (so the calc is not done every time a parameter is updated)

rename calc column (2) to calc column

 

The issue I'm running into here is that when I duplicate the calc column, the logic I'm using essentially copies the entire table and copies everything over with an exception clause. Everything is excluded except the one column I care about. The table is being saved as an embedded table, resulting in the file size exploding and becoming unusably slow. (see duplicate table.png)

My second option I've tested is very similar:

 

(after initial creation - delete entire data table 2)

create entire new data table - exact copy of first data table

everything after this happens in the second data table

creates calc column

duplicates calc column resulting in a static column (what I'm wanting). called calc column (2)

delete calc column (so the calc is not done every time a parameter is updated)

rename calc column (2) to calc column

create all data relations with other tables

update every single visualization to reference the new data table

update filtering schemes in new data table to be correct

 

So I basically create an entire new table and perform everything from my first option plus additional things. Then I delete the table and recreate it every time the end user clicks the button to update the calc column. I do this so that the file size does not increase, because delete the data table deletes all the embedded tables that are created. This is also slow...

I think my best option to solve this is to duplicate my calc column and store as a static column, then delete the calc column WITHOUT embedding the entire data table. How, in IronPython, do I duplicate a column without using the logic to duplicate the table and then exclude all columns except the one I care about. Any other advice is also appreciated.

 

Thanks!

Link to comment
Share on other sites

  • 3 weeks later...

Create an action button that updates all the user document properties to document properties connected to your calculated columns. Using a python script on the click of the action button should result in all the calculated columns updating at the same time.

 

This works well for me when I have four document properties being used in calulated columns.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...