2

I have a usecase where I need to return an integer as output from a synapse notebook in pipeline and pass this output in next stage of my pipeline.

Currently mssparkutils.notebook.exit() takes only string values. Is there any utility methods available for this? I know we can cast the integer to string type and send it to the exit("") method. I wanted to know if I could achieve this without casting.

boom_clap
  • 129
  • 1
  • 12

2 Answers2

1

cast()function is the standard and official method suggested by Spark itself. AFAIK, there is no other method. Otherwise, you need to manage it programmatically.

You can also try @equals in dynamic content to check whether the exitValue fetched from the notebook activity output equals to some specific value.

@equals(activity('Notebook').output.status.Output.result.exitValue, '<value>')

Refer: Spark Cast String Type to Integer Type (int), Transform data by running a Synapse notebook

Utkarsh Pal
  • 4,079
  • 1
  • 5
  • 14
0

instead, you can convert the string number to an integer in dynamic content. like this:

@equals(
    int(activity('Notebook').output.status.Output.result.exitValue)
    ,1)

or add an activity that sets the string value to a variable that is an int.

devale
  • 41
  • 4