increment the value of a variable

arkiboys 9,706 Reputation points
2022-02-11T08:36:29.3+00:00

Hi,
The variable is set to the value of a column, i.e. 1
Now I would like to increment it by 1 and so I use the following expression
@ABDULLLAH (int(variables('vOID')), 1)

But the error is:
Expression of type: 'int' doe snot match field 'condition'

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,623 questions
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,642 Reputation points Microsoft Employee Moderator
    2022-02-11T20:43:06.303+00:00

    Hello @arkiboys ,

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

    From my understanding, you would want to increment the value of a variable using set variable activity. But you are receiving the above error. Please correct if I'm not accurate.

    By looking at the error message Expression of type: 'int' does not match field 'condition' it doesn't seem like the error/warning is from set variable activity. The error says field 'condition' which is there for Filter activity, if that is the case the filter activity condition expects expression output to be a Boolean either true or false not a string value. Please see below.

    173639-image.png

    Filter activity contition should be something similar below (just an example):

    173685-image.png

    But incase if you are trying to increment a value of a variable in SetVariable activity, your expression should be as below. You will have to convert the incremented value from integer to string as your variable is of type string. Else it will throw an error something like -> The variable 'outValue' of type 'String' cannot be initialized or updated with value of type 'Integer'. The variable 'outValue' only supports values of types 'String'.

    Expression: @string(add(int(variables('vOID')),1))

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

0 additional answers

Sort by: Most helpful

Your answer

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