Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Decode in Attribute

Status
Not open for further replies.

petperson

Programmer
Oct 2, 2002
106
US
Hi - I'm new to MSTR and Oracle, and I'm trying to create an attribute and utilize the decode function in Oracle. What I want to do is - if a Region = "West Coast", then I want it to = "WC". How do I apply this in the attribute format? thanks!
 
You need to use an applysimple statement in the attribute or fact editors.

If the syntax of DECODE is this:

DECODE(<value>, <statement1>, <directive1>, <directive_default>)

You will need to implement an applysimple that looks something like this:

ApplySimple(&quot;DECODE(#0, <statement1>, <directive1>, <directive_default>)&quot;, MSTR_Region)

#0 is the place holder for your attribute or fact.

This should get you started...for more info on how to do conditional formatting look at TN5200-071-0120 in the KBase.

Chael

 
thanks Chael - but another (stupid) question..is <statement1> what I want it to be (ie, &quot;WC&quot;)? Is <Directive1> what it is (&quot;West Coast&quot;) and is <directive_default) also the same (&quot;West Coast&quot;)?

thanks!
 
Try this, altering my region for what you have as an attribute name:

ApplySimple(&quot;DECODE(#0,'West Coast','WC','East Coast','EC','Other')&quot;, region)

'Other' is the Default directive but it is not required.

I am not sure if this will work since I do not have an Oracle instance upon which to check this.

Chael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top