Hi - Thanks for your time,
can anyone guide me - I am trying to use an if with applymap but looks iam missing something
IF(EMPLEVEL <> 'Non-Employee' , APPLYMAP('EmpMapping',EMPNO,'Other'),EMPLEVEL AS TESTING
If the EMPNO is same as EMP_NBR then use the APPLYMAP to get the EMPLEVEL from abc else use the EMPLEVEL from xyz
but I see everything coming from xyz - any help
thanks a lot
Not sure if I completely understand, but you are def. missing a parenthesis ()) at the end of your If Statement, but that should have given you an error when you ran your script. So not sure what the exact problem is:
IF(EMPLEVEL <> 'Non-Employee' , APPLYMAP('EmpMapping',EMPNO,'Other'),EMPLEVEL) AS TESTING
I was thinking of proposing something similar, but my only concern is what if a non-employee also has a EMPNO in the mapping table? This completely doesn't make sense, but since I was not sure of the data behind this I was hesitant in proposing this.
Apart from a missing closing bracket on the applymap line (which I assume is a typo in your post) the logic looks fine. Have you checked that the data in EMP_NBR has the same values and data type as the date in EMPNO? Have you confirmed that there are values other than Non-Employee in EMPLEVEL from XYZ?
well, mee too I wasn't sure to completely understand the question but I think sometimes it's better to provide an answer maybe incorrect but useful to clarify the question and then to find the right answer
Thank you all of you for your time, yes the data types are same as I am reading from the QVD files
1) Non-Employee exists only in XYZ - majority of the Non-Employee level in xyz do not exist in abc, only few may be less than 10 exist in ABC (this is how the data is - actual EMPNO's considered as non-employee which is weird)
2). there are some employees who are terminated and exist in xyz but not in abc (again it is the data)
I tried this but still I see lot of emp levels from XYZ - APPLYMAP('EmpMapping',EMPNO,EMPLEVEL)
Thank you again for your time
So if I understand correctly, you are trying to bring in the employee level from abc.qvd into your testing table as a column name Testing. But your issue is that it is unable to map it from the abc.qvd and showing you the employee level from xyz.qvd only??? Have I understood your question?
One thing that comes to my mind is, do you have one to one mapping in your EmpMapping table? Because if a single employee number is mapped to multiple levels, the output may be not what you expect.
I think a (
EMP_NBR as EMPNO,
EMPLEVEL as EMPLEVEL2
and a chart/table could help to understand the problem (as jonathan suggested)
If expression with the applymap is working fine - but because of the data I get issues - like emp's existing in xyz do not exist in abc etc - attached sample for your reference - again thanks a lot for your help