Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi to all,
I need to do a unit measure conversion, starting from a fact table and convert the qty from "original UM" to "destination UM".
Instead of convert it using a big formula inside the load I wanted to use a subroutine.
It works but I can't use the call inside a load.
I attach my example.
Any idea to do it with the subroutine or different solution for the same problem without doing all the calculation inside the load ?
Thanks
Sergio
Hi
The Call does not return a value, so you can't use it like that.
I suggest that you do a load like this
Data:
LOAD UM,
MATE,
QTY * ConverOrig / ConverDesti AS QtyConv,
QTY,
TO;
LOAD *,
subfield(ApplyMap('ConversionMap',MATE & UM,' '),';',1) / subfield(ApplyMap('ConversionMap',MATE & UM,' '),';',2) AS ConverOrig,
subfield(ApplyMap('ConversionMap',MATE & 'CS',' '),';',1) / subfield(ApplyMap('ConversionMap',MATE & 'CS',' '),';',2) AS ConverDesti;
LOAD UM,
MATE,
(Call Convert(MATE,UM,'CS',QTY)) as QtyConv,
QTY,
TO
RESIDENT DataTmp;
Just check that I converted the two subfield lines correctly.
Jonathan
Hi Anyone found a way to solve the issue in an easy way ?
Thanks
Hi
The Call does not return a value, so you can't use it like that.
I suggest that you do a load like this
Data:
LOAD UM,
MATE,
QTY * ConverOrig / ConverDesti AS QtyConv,
QTY,
TO;
LOAD *,
subfield(ApplyMap('ConversionMap',MATE & UM,' '),';',1) / subfield(ApplyMap('ConversionMap',MATE & UM,' '),';',2) AS ConverOrig,
subfield(ApplyMap('ConversionMap',MATE & 'CS',' '),';',1) / subfield(ApplyMap('ConversionMap',MATE & 'CS',' '),';',2) AS ConverDesti;
LOAD UM,
MATE,
(Call Convert(MATE,UM,'CS',QTY)) as QtyConv,
QTY,
TO
RESIDENT DataTmp;
Just check that I converted the two subfield lines correctly.
Jonathan
Great !
I didn't know I could use this way to reload data and so to use precalculated variables
Thanks
Sergio
hi there Jonathan,
iv read this tread and it seems i am missing something in the code you suggested.
where is the table "DataTmp" that you are Resident loading from?
where is the definition of the Mapping table "ConversionMap"?
and can you please explain how you are using the CALL coomand inside a load statement.
thanks for your time
Mansyno
Mansyno
This was posted some time ago, but I seem to recall the DataTmp and ConversionMap are defined in the qvw attached to the original post. Open that qvw for more info.
If you want a better response, you might start a new thread on this topic. You can always put a link back to this thread in your post.
Regards
Jonathan