Auto populate field based on another field selection (130 Views)
Reply
Occasional Contributor
Posts: 6
Registered: ‎12-01-2010
Message 1 of 4 (130 Views)

Auto populate field based on another field selection

Seems like the best way to do this would be a rule, but not sure what the sql statment should be.
Honored Contributor
Posts: 725
Registered: ‎05-09-2008
Message 2 of 4 (130 Views)

Re: Auto populate field based on another field selection

The simplest case would be something like:

select 'x','x' from dual

For more complex cases, you can include a decode function, union clauses, case statements or other sql stuff that meet your needs. You can also pull data from any fields in any defined tables, like:

select user_data1,visible_user_data1 from knta_users where user_id=[SYS.USER_ID]
Occasional Contributor
Posts: 6
Registered: ‎12-01-2010
Message 3 of 4 (130 Views)

Re: Auto populate field based on another field selection

Thats the way we have it now, I gues I just need to create a rule for each condition?
Honored Contributor
Posts: 725
Registered: ‎05-09-2008
Message 4 of 4 (130 Views)

Re: Auto populate field based on another field selection

One rule per condition is one option. Another would be to use a decode function:

select decode('[REQD.VP.FIELD1]','value1','newvalue1','value2','newvalue2', ... ,'default'), from dual

Other variations are useful in some cases. It depends on how the field values are related and what kind of algorithm you can design to get from one to the other.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.