Why does the Item() throw error if referring to the child items as item().Asset ID inside the Append variable activity as an inner activity in For each activity in ADF?

Eshan Gangwar [ESHN] 1 Reputation point
2022-03-03T05:13:36.027+00:00

I am trying to add value to the variable in the append variable activity.

@markus.bohland@hotmail.de (coalesce(item().TagId,'NULL'),'|',coalesce(item().SourceId,'NULL'),'|',coalesce(item().Source,'NULL'),'|',coalesce(item().Collection Frequency,'NULL'),'|',coalesce(item().Aggregation,'NULL'),'|',coalesce(item().Aggregation Interval,'NULL'),'|',coalesce(item().Upload Interval,'NULL'),'|',coalesce(item().Description,'NULL'),'|',coalesce(item().UoM,'NULL'),'|',coalesce(item().Asset ID,'NULL'),'|',coalesce(item().CloudId,'NULL'),'^')

It only accepts when value is being provided without spaces as coalesce(item().AssetID,'NULL') and it fails when value is being provided with spaces in between
like coalesce(item().Asset ID,'NULL'). These values with spaces are column names coming from the csv file.

The question is why is it not being accepted as is coming from the source.

Error
Notifications
{"code":"BadRequest","message":null,"target":"pipeline//runid/30ddbbef-98ce-4bca-8c17-34ee4fb08876","details":null,"error":null}

Error:

179532-image.png

179502-image.png

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

2 answers

Sort by: Most helpful
  1. AaronHughes 391 Reputation points
    2022-03-07T09:58:39.61+00:00

    I am not sure there is an option to wrap column names in the @item().colname function
    so i would suggest on the task you gathering these I would suggest you rename the column [Asset ID] to AssetID/Asset_ID to remove the error

    1 person found this answer helpful.
    0 comments No comments

  2. AnnuKumari-MSFT 32,906 Reputation points Microsoft Employee
    2022-03-06T08:08:06.883+00:00

    Hi @Eshan Gangwar [ESHN] ,

    Thankyou for using Microsoft Q&A platform and posting your query.

    As I understand your query, you are using Append variable activity inside ForEach block and in the Append variable expression , you are trying to make use of few fields which has space in them . For instance: it's throwing error while using a field called 'Asset ID'.

    Spaces are not expected in the field name the same way as it's not allowed in SQL DB to create a table having column with spaces. It would throw syntax error if you do that. You can either go with the field name as AssetID or Asset_ID.

    Please refer to the following gif:
    180378-appendvariable.gif

    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

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.