The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Setting a default value in a table component field from a request field

Highlighted
ssirwin
Occasional Advisor

Setting a default value in a table component field from a request field

I would like to use the "Apply on Creation" rule for a table component rule to set a default value in a table component field. The catch is that I would like to set this default value to be based on a value in a field in the request itself.

 

I did not see a way to do this by referencing the request field token. Is there another way I can accomplish this?

8 REPLIES
Rash
Regular Collector

Re: Setting a default value in a table component field from a request field

Hi,

 

You can achive it by writing a SQL function and calling it on a rule on creation depending on the other request type field value.

But only constraint here you need to handle it Table component values will be updated from back end.. but it initially takes time to refresh in frontend. So you need to clear the Table component refresh time to 0 or something to make the value visible at earliest in front end.

 

Cheers,

Rash

Jim Esler
Honored Contributor

Re: Setting a default value in a table component field from a request field

When we make table component changes with datatabase queries, we use a clear cache command to clear the Table Field Entries cache. This makes the new values available immediately in the front end while still taking advantage of the performance improvements provided by caching.

ssirwin
Occasional Advisor

Re: Setting a default value in a table component field from a request field

Thanks for the response. What is the command to clear the table entries cache - and can I call that at the same time as I call the SQL function? I only know about clearing the cache at the server level.

Jim Esler
Honored Contributor

Re: Setting a default value in a table component field from a request field

We use the following to clear a cache:

 

ksc_local_exec sh "cd bin;./kRunCacheManager.sh [CACHE_ID]"

 

A list of cache ids is available by executing the kRunCacheManager.sh script with no parameters. In version 9.14, the Table Field Entries cache is number 8. Cache numbers changed between PPM 7.5 and 9.1. I do not know if they changed again with 9.2 or what the values are in any other version.

 

 

ssirwin
Occasional Advisor

Re: Setting a default value in a table component field from a request field

Thanks for the info!

pepdwill
Senior Member

Re: Setting a default value in a table component field from a request field

Jim -

 

Is there any downside to setting the TC cache refresh to 0, as opposed to clearing the cache via command each time as you suggested?

Jim Esler
Honored Contributor

Re: Setting a default value in a table component field from a request field

The purpose of the cache is to be able to pull the data from memory when it is needed rather than query the database each time. The cache is used to improve performance. The only effect of disabling the cache is that performance will be worse.

pepdwill
Senior Member

Re: Setting a default value in a table component field from a request field

Thanks, good to know. 

//Add this to "OnDomLoad" event