Los tipos de archivo clásicos dejarán de estar disponibles a partir de enero de 2021. Puedes migrar tus archivos clásicos o descargar un PDF. Más información

Converting (Blank) values into null values Issue

Respondida
0

Comentarios

1 comentario

  • Mike Davis

    Hi Angel!

    I asked some experts on my end and we have some possible solutions for you here.

    To convert the "(Blank)" values in Wdata to null, you can consider the following recommendations based on SQL functions commonly used in Wdata:

    1. CASE Statement: You can use a CASE statement to evaluate conditions and set the values to NULL if they meet specific criteria:

    sql
      CASE
          WHEN expression IS NULL THEN NULL
          WHEN expression = '(Blank)' THEN NULL
          ELSE expression
      END
     

    Ensure that the conditions in your CASE statement correctly identify the "(Blank)" values.

    2. COALESCE Function: Utilize the COALESCE function to return the first non-null value. If "(Blank)" is considered the last option, you can set the earlier options to potentially existing real values while defaulting to null if necessary:
     

    sql
      SELECT COALESCE(expression, NULL)
      FROM your_table
      WHERE expression = '(Blank)'
     

     
    3. CAST and TRY_CAST: If you're dealing with numerical fields, consider using CAST or TRY_CASTTRY_CAST is helpful to return NULL when a conversion fails:

    sql
      TRY_CAST(expression AS type)
     

    4. IS NULL and IS NOT NULL Operators: Use these operators to handle conditions where values should be treated as null or non-null:
     

    sql
      SELECT *
      FROM your_table
      WHERE expression IS NULL
     

    Applying these strategies can help address the conversion of "(Blank)" values to NULL. Make sure your SQL conditions and expressions align with the exact structure and data within your Wdata setup.

    Here's an article on our SQL expressions: https://support.workiva.com/hc/en-us/articles/360042533552-SQL-conditional-expressions.

    Let me know if I've missed the mark or you have any follow-ups for me. Cheers!

    0

Iniciar sesión para dejar un comentario.