Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
PanuO
Frequent Visitor

Use iteration object in data copy mapping

I have dataflow which makes REST call to get different courses from API. For each course I need to get more detailed content. I have dataflow that uses Data Copy action to get all the courses and then I have For Each action that iterates every item received from API. I am able to do an another REST API call to get detailed course information, but the API response does not have the course identifier. I have it in the iteration item, but I cannot use it in mapping section. If I try to put item().id or {item().id} it produces an error:

ErrorCode=UserErrorSchemaMappingCannotInferSinkColumnType,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Data type of column 'id' can't be inferred from 1st row of data, please specify its data type in mappings of copy activity or structure of DataSet.,Source=Microsoft.DataTransfer.Common,'

 

Is there a way to use iteration object in mapping / should I do my dataflow in some another way? I have used the item().id in relative path, so I know it works there.

 

PanuO_0-1697030690307.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PanuO ,

Can you please add column type to int (or respective type) and try to rerun the pipeline, let me know if you are still facing the same issue.

ttttt.png

Add on - Please refer these videos that might help you with your issue.

32. Copy data from REST API which sends response in Pages using Azure data factory - YouTube
21. Dynamic Column mapping in Copy Activity in Azure Data Factory - YouTube

Thank you

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @PanuO  - Thanks for using Fabric Community,

As I understand you are trying to fetch data using API in Fabric Data Factory with the help of pipelines.

Can you please confirm if your pipeline design is similar to below screen shot?
ttt.png

Can you please share some details along with screenshots regarding your approach and issue.
I would be able to help you better if you can provide these details.

That is quite close. I now have datalake as input, because it is faster to test that way (I have stored data in there so I don't want to fetch it all the time when I test this).

The foreach has following Items setting: 

@activity('Get courses from datalake').output.value
This is the pipeline:

PanuO_0-1697103914846.png

 

Anonymous
Not applicable

Hi @PanuO  - Thanks for your response.

Can you please share a complete screenshot of for loop settings and copy data activity settings.

Eg:
For Loop -

vgchennamsft_1-1697105948738.png

 



Copy Data -

vgchennamsft_0-1697106365925.png

 



vgchennamsft_0-1697105897388.png

 

Loop:

PanuO_2-1697106401941.png

 

 

Copy Data:

PanuO_1-1697106360962.png

(The API has result objects inside array called results, so thats why I need to use the collection reference in mapping)

Anonymous
Not applicable

Hi @PanuO ,

Can you please add column type to int (or respective type) and try to rerun the pipeline, let me know if you are still facing the same issue.

ttttt.png

Add on - Please refer these videos that might help you with your issue.

32. Copy data from REST API which sends response in Pages using Azure data factory - YouTube
21. Dynamic Column mapping in Copy Activity in Azure Data Factory - YouTube

Thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.