Announcements
Product Release Webinar: Qlik Insider airing December 6! REGISTER TODAY!
cancel
Showing results for
Did you mean:
Creator

## Use fieldNames within a table to determine algorithm and get a result

Hi all.

I am struggling with something that should be reallly easy 😞

I have this table:

 fieldA fieldB algorithm 1 3 fieldA*fieldB 2 4 fieldB 2 8 fieldB/fieldA

and just want to obtain a result field such as:

 fieldA fieldB algorithm result 1 3 fieldA*fieldB 3 2 4 fieldB 4 2 8 fieldB/fieldA 4

How do I "catch" fieldA and field B to get result?

I need to "make it" within the script.

Kind regards.

Labels (3)

• ### Field value

1 Solution

Accepted Solutions
Creator II

hi, here this a possible solution

Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B')) AS CAL,
if(Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B'))='*',fieldA * fieldB,
if(Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B'))='/',fieldB / fieldA,
if(Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B'))='',fieldB
)
)
) as Result,

* Inline [
fieldA, fieldB, algorithm
1, 3, fieldA * fieldB
2, 4, fieldB
2, 8, fieldB / fieldA
];

+55(44) 9 9993-3605, WhatsApp
E-Mail or Skype - danilo16stochi@hotmail.com
Creator II

hi, here this a possible solution

Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B')) AS CAL,
if(Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B'))='*',fieldA * fieldB,
if(Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B'))='/',fieldB / fieldA,
if(Trim(PurgeChar(algorithm,'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B'))='',fieldB
)
)
) as Result,

* Inline [
fieldA, fieldB, algorithm
1, 3, fieldA * fieldB
2, 4, fieldB
2, 8, fieldB / fieldA
];

+55(44) 9 9993-3605, WhatsApp
E-Mail or Skype - danilo16stochi@hotmail.com
Community Browser