Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

farolito20
New Contributor III

How to to a JScript Macro?

How to do something like this?

Function fnConvTooQQ(uniBase,cantBase){

          var cantReturn;

          var factConv;

          if (uniBase=="LTA" || uniBase=="FGS" || uniBase=="QQ"){

                    cantReturn=cantBase;

          }

          else {

                    factConv = "LOAD FC as factConv FROM vConversionUM.qvd (qvd) WHERE UMO = uniBase and UMD='QQ'";

                    cantReturn = cantBase * factConv;                     

          }

          return cantReturn;

};

2 Replies
MVP & Luminary
MVP & Luminary

Re: How to to a JScript Macro?

I don't think you can use a load statement in a macro. But I don't think you need to either. This might do what you want:

MapFC:

mapping LOAD uniBase, FC FROM vConversionUM.qvd (qvd) WHERE UMD='QQ';

 

T2:

load *,

if(match(uniBase,'LTA','FGS','QQ'), 1, applymap('MapFC',uniBase)) * cantBase as ConvertedToQQ

from ....;


talk is cheap, supply exceeds demand
farolito20
New Contributor III

Re: How to to a JScript Macro?

Thanks This work because I just compare one field, but if I need compare 3 fields the mapping not work.

I'm new in vbscript and I need how to load a qvd in my vbscript...

Help please