Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to call the function from straight table

Hi,

I have written a function to calculate the performance bounce.

 

function Partner_policy( rt , ctr)

dim temprt
dim tempctr

temprt=rt
tempctr=ctr
temp

if (temprt<80 and tempctr<65) then
temp=temprt

elseif ((temprt>=80 and temprt<85) and ctr<65) then
temp=70
elseif ((temprt>=85 and temprt<90) and ctr<65) then
temp=75
end if

Partner_policy=temp
end function

Now i the rt & ctr loaded in straight table. so i want this performance bounce to be loaded in straight table can anyone help me in this.

Regards,

Grace Rashmi

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Create a variable like this

SET Expression =  if ($1<80 and $2<65), rt,

    if ($1>=80 and $1<85 and $2<65, 70,

       if ($1>=85 and $1<90 and $2<65, 75)))

and use this variable in the expression of straight table

=$(Expression(rt, ctr))

Refer http://community.qlik.com/docs/DOC-3836 for help.

This calculates the performance in straight table itself. 

As per Gysbert Wassenaar   suggestion it is better calculate in the script itself.

Hope this helps you.

Regards,

Jagan.

View solution in original post

3 Replies
Gysbert_Wassenaar

You cannot use the function in a straight table. And you don't need the function in the script. Create a new field in the script:

if (rt<80 and ctr<65), rt,

    if (rt>=80 and rt<85 and ctr<65, 70,

       if (rt>=85 and rt<90 and ctr<65, 75))) as Partner_policy


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

Create a variable like this

SET Expression =  if ($1<80 and $2<65), rt,

    if ($1>=80 and $1<85 and $2<65, 70,

       if ($1>=85 and $1<90 and $2<65, 75)))

and use this variable in the expression of straight table

=$(Expression(rt, ctr))

Refer http://community.qlik.com/docs/DOC-3836 for help.

This calculates the performance in straight table itself. 

As per Gysbert Wassenaar   suggestion it is better calculate in the script itself.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

thnks a lot.. it is perfect.