Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How can I return a value from a function?
This might work ...
Let v = functionName(value);
... or you can do row-level function changes using ...
Data:
Load
field,
functionName(field) as newField
...
flipside
for getting most repeated value we can use mode(value)..
I think ur question is nt clear
I need something like this. This isn't correct but that's the idea
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;
};
This might work ...
Let v = functionName(value);
... or you can do row-level function changes using ...
Data:
Load
field,
functionName(field) as newField
...
flipside
But if I have this code in a sub.. end sub, I can't return a value?
Yes, I think so. The name of the sub causes an error in QV script editor, whereas a function even prompts you for the number of parameters required.
You can define a subroutine earlier in the load script and call it using the CALL command - see QV help - but this is a QV sub not a module sub.
flipside