4 Replies Latest reply: May 5, 2017 3:16 AM by Rahul Pawar

How to convert dimension expression to load script expression ?

Hi All

I have field name = aging_ar

This field have number from 1 to 360

I like to create a new filed name = aging_ar_class

which is

1=1-30

2=31-60

3=61-90

In chart dimension expression below working fine :-

=If(aging_ar >= 1 and aging_ar <= 30, Dual('1-30', 1),

If(aging_ar >= 31 and aging_ar <= 60, Dual('31-60', 2), Dual('>61', 3)))

I have try convert the above expression to below for load script expression  :-

If(aging_ar >= 1 and aging_ar <= 30, Dual('1-30', 1),

If(aging_ar >= 31 and aging_ar <= 60, Dual('31-60', 2), Dual('>61', 3))) as aging_ar_class,

it does not work , Hope some one can advise me.

Paul

• Re: How to convert dimension expression to load script expression ?

Looks OK to me. What is it doing incorrectly?

The conditions may fail if the ages are computed and are not integers. Modify it to this:

If(aging_ar < 1, Dual('0', 0),

If(aging_ar <= 30, Dual('1-30', 1),

If(aging_ar <= 60, Dual('31-60', 2),

Dual('>61', 3)))) as aging_ar_class,

to guarrantee a value in every row.

• Re: How to convert dimension expression to load script expression ?

Hello Paul,

May be try below:

```If(aging_ar >= 1 and aging_ar <= 30,
'1-30',
If(aging_ar >= 31 and aging_ar <= 60,
'31-60',
'>61')) AS aging_ar_class

```

Regards!

Rahul

• Re: How to convert dimension expression to load script expression ?

Hi Rahul

Wow you are good. Thank you very much.

Paul Yeo

• Re: How to convert dimension expression to load script expression ?

Cheers,

Rahul