Can I have a parameterized value in a Set Variable Activity in ADF

Mike Kiser 1,536 Reputation points
2021-02-13T16:58:43.167+00:00

Hello.
I have an issue; can I have a value like the following in a Set Variable Activity that is in a Switch Activity?
Please see attachment.
Thanks!!
Mike Kiser @MartinJaffer-MSFT @Nasreen Akter

Essentially what I have is a phone number stored in the DB as a String and I bring it back in a Lookup (which is working) and want to move that Phone number into a Set Variable so that I can use it in the Body of my Web Activity:

Variable Value: "@{item().phoneNumber}" variable is a String...stored as String in DB
I am getting an error

The execution of template action 'SwitchSwitch for PhoneType' failed: The result of the evaluation of 'scope' action expression '@Tomas Podoba ('MainSwitch for PhoneType')?.expression' is not valid. It is of type 'Boolean' but is expected to be a value of type 'String, Integer'.The execution of template action 'SwitchSwitch for PhoneType' failed: The result of the evaluation of 'scope' action expression '@Tomas Podoba ('MainSwitch for PhoneType')?.expression' is not valid. It is of type 'Boolean' but is expected to be a value of type 'String, Integer'.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

Answer accepted by question author
  1. HimanshuSinha 19,527 Reputation points Microsoft Employee Moderator
    2021-02-15T19:04:58.817+00:00

    Hello @Mike Kiser ,
    Thanks for the ask and using the Microsoft Q&A platform .

    I see that you have mentioned that you are using the switch statment . Since you have not shared the expression for the switch statement I am going to make some assuming but i think the issue is in the expression in the switch statement . The
    "Expression that must evaluate to string value" , please read about that here . Also you mentioned about the phonenumber but the error complains about PhoneType . Are you missing something ?. Please share the JSON of the pipeline .

    I think you will have to set the PhoneType in the expression . I am sharing a dummy pipeline below where I use the switch statement and read the first value from the phone and try to find the country which it belongs ( all dummy data , but i guess it may help you ) .

    68374-switch.gif

    Thanks
    Himanshu
    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.