Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
farolito20
Contributor III
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
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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
Contributor III
Contributor III
Author

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