question

FranciscoDominguez-7929 avatar image
0 Votes"
FranciscoDominguez-7929 asked KranthiPakala-MSFT commented

Script activity failed: Argument {0} is null or empty. Parameter name: paraKey

Hi,

Please see this topic for reference: https://docs.microsoft.com/en-us/answers/questions/763892/script-activity-failed-argument-0-is-null-or-empty.html

I'm getting the same error in the Script1 activity in the following JSON:

 {
                 "name": "For each status change",
                 "type": "ForEach",
                 "dependsOn": [
                     {
                         "activity": "Filter status changes",
                         "dependencyConditions": [
                             "Succeeded"
                         ]
                     }
                 ],
                 "userProperties": [],
                 "typeProperties": {
                     "items": {
                         "value": "@activity('Filter status changes').output.Value",
                         "type": "Expression"
                     },
                     "activities": [
                         {
                             "name": "Insert changelog",
                             "type": "Script",
                             "dependsOn": [],
                             "policy": {
                                 "timeout": "0.00:02:00",
                                 "retry": 0,
                                 "retryIntervalInSeconds": 30,
                                 "secureOutput": false,
                                 "secureInput": false
                             },
                             "userProperties": [],
                             "linkedServiceName": {
                                 "referenceName": "DatawithoutDV",
                                 "type": "LinkedServiceReference"
                             },
                             "typeProperties": {
                                 "scripts": [
                                     {
                                         "type": "Query",
                                         "text": {
                                             "value": "@concat('DELETE FROM IssueChangelog WHERE changelogId=', item().id, ' ',\n    'INSERT INTO IssueChangelog (changelogId, issueId, changeDate, type, fromStatus, toStatus, diffToPreviousStatus) VALUES (',\n    item().id, ', ',\n    pipeline().parameters.issueId, ', ',\n    '''', substring(item().created, 0, 22), ''', ',\n    '''', item().items[0].field, ''', ',\n    '''', item().items[0].fromString, ''', ',\n    '''', item().items[0].toString, ''', ',\n    string(0), ')'\n)",
                                             "type": "Expression"
                                         }
                                     }
                                 ]
                             }
                         },
                         {
                             "name": "Script1",
                             "type": "Script",
                             "dependsOn": [
                                 {
                                     "activity": "Insert changelog",
                                     "dependencyConditions": [
                                         "Succeeded"
                                     ]
                                 }
                             ],
                             "policy": {
                                 "timeout": "7.00:00:00",
                                 "retry": 0,
                                 "retryIntervalInSeconds": 30,
                                 "secureOutput": false,
                                 "secureInput": false
                             },
                             "userProperties": [],
                             "linkedServiceName": {
                                 "referenceName": "nucleooDatawithoutDV",
                                 "type": "LinkedServiceReference"
                             },
                             "typeProperties": {
                                 "scripts": [
                                     {
                                         "type": "Query",
                                         "text": {
                                             "value": "@concat('SELECT MAX(changeDate) FROM IssueChangelog WHERE issueId=', pipeline().parameters.issueId)",
                                             "type": "Expression"
                                         }
                                     }
                                 ]
                             }
                         }
                     ]
                 }
             }


pipeline().parameters.issueId has a value and its valid. If I run the same query in my Azure Data Studio, I obtain the expected result.

Thanks in advance.

azure-data-factory
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KranthiPakala-MSFT avatar image
3 Votes"
KranthiPakala-MSFT answered KranthiPakala-MSFT commented

Hello @FranciscoDominguez-7929,

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

Just to clarify the problem - you are seeing above error message while trying to use the script activity. From the reference link, it seems like you have received this error message due to the query formation, when you changed query from A to B it got resolved in the reference link. But again, you have noticed same error message when using Script activity for another query. Please correct if my understanding is not correct.

By looking at the query I don't see anything wrong, except for the second query where you are selecting the max change date without giving a alias column name to it. Please try providing a column alias name to the return value in your second query for selecting Max change date which should help resolve the issue.

Could you please try below and see if that helps to resolve the issue?

 @concat('SELECT MAX(changeDate) as  MaxChangeDate FROM IssueChangelog WHERE issueId=', pipeline().parameters.issueId)

I did try to reproduce the problem and was able to find that not giving a column alias name for the return values generates the above error message. For more clarification, please see below GIF.

184761-scriptactivityerror.gif

Please let us know if that helps to resolve the issue. In the meantime, I will reach out to respective product owners to notify this issue and will see if we can add this information in public documentation as a note.

Hope this helps. Do let us know how it goes.


  • 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



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @FranciscoDominguez-7929,

Just checking in to see if the above answer helped. If this answers your query, do click Accept Answer and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·