2021 Feb 28 8:14 AM
Hi Experts,
I have developed a CDS view and one of the column in it is of Bill of Lading(BOLNR).
My requirement is to put '#' if BOLNR is initial. I tried with Coalesce and Case Statement with below code but it is not working as expected.
Code1 - coalesce( _likp.bolnr, '#' ) as bolnr,
Code2- cast ( case when _likp.bolnr = ' ' then '#' else _likp.bolnr end as bolnr) as bolnr.
Is there any other away to achieve the above requirement in CDS View?
2021 Feb 28 9:32 AM
Coalesce only works if the value is null, which is currently only possible within a Join.
The Case should work through. I'm currently only at the Phone but is there something like "initial" or is that value not an empty string? In CDS there is much less automatik data type conversion which is also valid for constants.
2021 Feb 28 9:37 AM
Hello,
What is the error message you get?
Or is it just not producing the expected results?
Kind regards,
Mateusz
2021 Feb 28 12:33 PM
2021 Mar 01 8:31 AM
Hi Mahesh,
By using Case or Coalesce, it is working for some records, but not for all records. Please see below screen shots:
2021 Mar 01 8:26 AM
Hi All,
the issues with Coalesce and Case is, for some records which are blank, it is working as expected. But some it is showing blank.
Is it because BOLNR is CHAR35 and having Numeric as well as Alphabetical records?
2021 Mar 01 8:39 AM
Hi All,
For Some records if you use either a case or coalesce it is working but for some records its not working.blank-bolnr.pngnon-blank-bolnr.png
Please refer Attachments for more clarification on the issue.