Search code examples
variablescastingazure-data-factory

Convert ADF variable from string to Integer then increment by 1


I am struggling to convert a variable I assign to a integer than to add +1

I am reading in the size of a file in bytes in ADF and diving it to get the first number of the byte (e.g. 3234123 bytes and the output is 3) however, how it's setup is that it's being read in as a string, and I also want to add 1 to this value but I cannot figure out how to get that activity working. It is being assigned to the String 'cnt'. So wondering the process of if I am able to cast this 'cnt' string to an Integer and add 1 to this value and be able to then reference this 'cnt' further in the pipeline.

Thanks, hope there is enough here for you to understand my problem.

enter image description here


Solution

  • In order to add 1 to the value, before converting the value to string, you can use add() function and add 1 to the divided value.

    Expression: @string(add(div(activity('Get Cisco size').output.size,10000000),1))

    enter image description here

    • Value stored in variable before using add() function to add 1: enter image description here

    • Value stored in variable after using add() function: enter image description here