check if the value is a number and output in iif logic of derived transformation

Peruka, Sikander reddy 45 Reputation points
2024-05-18T23:01:01.27+00:00

I am checking if the input value is a number then output as '100' else 'invalid' in derived transformation in dataflow.

In the documentation, I found 'isLong' function. But, how do we use this function in an iif statement.

https://learn.microsoft.com/en-us/azure/data-factory/data-flow-expressions-usage#islong

The following code isn't working.

iif(isLong(column1),'100','Invalid')

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,526 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,847 questions
{count} votes

Accepted answer
  1. Smaran Thoomu 11,290 Reputation points Microsoft Vendor
    2024-05-20T05:10:06.4333333+00:00

    Hi @Peruka, Sikander reddy

    Thanks for the question and using MS Q&A platform.

    To check if the input value is a number and output '100' if it is, and 'invalid' if it is not, you can use the isLong function in an iif statement in the derived transformation in data flow.

    The syntax for using isLong function in an iif statement is correct. However, the issue might be with the input column. Please ensure that the input column 'column1' is of string data type.

    Here is the correct expression of how to use the isLong function in an iif statement:

    iif(isLong(toString(column1)),'100','Invalid')
    
    

    The toString function is used to convert the input column to a string data type, which is required for the isLong function to work correctly.

    I hope this helps! Let me know if you have any further questions.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more