You can translate the question and the replies:

Converting value in a field

Hello there, I am currently trying to add a projection to a dervied view that checks the values of two fields and if they are equal then the values for one of the fields shoud be turned into an empty string. I was wondering if any one can give me a hand with this? I was trying to implement 'Case When' Thanks in advance. example:case WHEN (baseview.fieldname1 = baseview.fieldname2) THEN (baseview.fieldname 1/2 should be turned into empty) ELSE baseview.fieldname 1/2 END
user
21-08-2017 10:18:57 -0400
code

2 Answers

Hi, For this scenario Instead of creating a new projection view I would edit the existing derived view. By modifying the field expression for the fields “fieldname1” and “fieldname2”. For example: case WHEN ("baseview"."fieldname1" = "baseview"."fieldname2") THEN ‘ ‘ ELSE "baseview"."fieldname1" END case WHEN ("baseview"."fieldname1" = "baseview"."fieldname2") THEN ‘ ‘ ELSE "baseview"."fieldname2" END I suggest you to have a look at the official documentation on [Case Clause](https://community.denodo.com/docs/html/browse/6.0/vdp/vql/queries_select_statement/case_clause/case_clause) and refer to the case clause examples from Virtual DataPort VQL Guide. Hope this helps you!
Denodo Team
22-08-2017 07:47:09 -0400
code
Hello there, Question: If it is only one of the fields that is going to be converted to an empty string after the cause clause should I just edit the case clause under the field name that is going to be converted to an empty string.
user
22-08-2017 11:32:20 -0400
You must sign in to add an answer. If you do not have an account, you can register here