Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
siva_boggarapu
Creator II
Creator II

How to make expression as Field in the load script

Hi Everyone.

I want to put below expressions into the script as Fileds. But its giving error while putting into the script.

morpheus_market:

load Year,

     [contract name],

     [contract name year],

     [RuleGroup Name],

     Carrier,

     [service class name],

     ClassCode,

     SellupAmount,

     Fare,

     Season ,

     City_from,

     City_to,

     From_region,

     To_region,

     farecomp_class,

     contractname

FROM

mopheusdata.qvd

(qvd);

I want to put below expression into the load script or is there anyway to manipulate the below expressions in simply way?

I want to make below expression as like

1)left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -9 )-1) as Market1

2)

mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -8)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -9 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -8 )-1))

) as Market2

set vMarket1=left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -9 )-1);

set vMarket2=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -8)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -9 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -8 )-1))

);

set vMarket3=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -7)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -8 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -7 )-1))

);

set vMarket4=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -6)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -7 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -6 )-1))

);

set vMarket5=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -5)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -6 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -5 )-1))

);

set vMarket6=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -4)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -5 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -4 )-1))

);

set vMarket7=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -3)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -4 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -3 )-1))

);

set vMarket8=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -2)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -3 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -2 )-1))

);

set vMarket9=mid(

left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -1)-1),

index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -2 )+1,

len(left(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -1 )-1))

);

set vMarket10=mid(GetFieldSelections([morpheus_market.contract name year],'|',10),index( GetFieldSelections([morpheus_market.contract name year],'|',10), '|', -1 )+1,

len(GetFieldSelections([morpheus_market.contract name year],'|',10)));

Thanks,

Siva

3 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

GetFieldSelections() is a UI-only function. At script run-time there are obviously no selections made so this function cannot work!

siva_boggarapu
Creator II
Creator II
Author

Hi Janson,

I am putting all the above Condtions in the Straight table Experssion. Due to this the chart is getting stuck while selection possible values in the designer script.

It would be great to me Can we make Simplyfy the above condtions.?

AA  XXX 11

AB  YYY 12

AD ZZZ 12

AX AAA 12

100

-

120

160

230

180

190

220

189

200

240

250

Actually my requriement is i have two fileds [contract name year], Fare  in the desigeer. When I am selecting 10 selection in first list box it should show those selections as columns w r to fare. For that only I had wrote above conditon. But its taking more time in chart while selecting

Note:I have 10 dimension and 14 expression  in the straight table.

Thanks,

Siva

Jason_Michaelides
Luminary Alumni
Luminary Alumni

I'm not sure I completely understand, could you provide an example of how you want the finished table to look? Sounds like [contract name year] could be a field in a pivot table and dragged to the top of the table...