cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jwxc
Frequent Visitor

Cannot get Import control to work

I have successfully set up an Export control to save the contents of a collection to a file. However, I am unable to work out the correct way of configuring an Import control to get this data back into a collection which can be used in the app.

My control is called impImportData and I have tried using the following code in the OnSelect property of the Import control itself and a separate button:

 

 

ClearCollect(colImportedData,impImportData.Data)

 

 

Whatever I try, I just get the error 'Invalid argument type' with the predominant red squiggle under the .Data part of the code. I have tried using impImportData.Data as a source for a DataTable but it complains that it is not being passed a Table. It seems therefore that the data is not being imported as a Table.

I have looked at the documentation for these controls but it isn't very detailed. I don't believe I have done anything that different to the example given. https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-export-import 

Has anybody been able to get this working successfully in their own apps? Any pointers would be appreciated.

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @jwxc ,

You have not said what your data source is, however the relevant table name will appear under View > Data Sources

You are trying to import the control rather than the data. I will call the name of your data source as it appears in this list MyData

To collect this data (assuming there re less than 2000 records)

 

ClearCollect(colImportedData,MyData)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

jwxc
Frequent Visitor

Thanks for your response, but I think you've misunderstood as I'm not trying to collect data from a Data source. I'm trying to use the Import control to import data from a zip file (as created by an Export control). These files contain a few json files and allow you to export and import Collections between apps.

Please read this post.
https://powerusers.microsoft.com/t5/Building-Power-Apps/Import-Export-Controls/td-p/16357

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution
jwxc
Frequent Visitor

Thank you. I already searched the forums and found that post, but it doesn't actually solve the problem. Taking that approach suppresses the error, but it doesn't populate a collection. When I check the contents of the collection, it is completely empty and doesn't even have a Data column.

I can't work out what data type is returned by .Data - I think that would be a good starting point to solving this.

v-xida-msft
Community Support
Community Support

Hi @jwxc ,

Could you please share a bit more about your error message?

 

I have made a test on my side, and don't have the issue that you mentioned. Based on the issue that you mentioned, I have made a test on my side, the issue is confirmed on my side.

 

I would post this issue to my product team, if this issue is solved, I would reply here.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-xida-msft
Community Support
Community Support

Hi @jwxc ,

I have posted this issue to my Product Team already. If there are any updates from them, I would reply here. Thanks for your feedback.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jwxc
Frequent Visitor

Hi @v-xida-msft ,

Thank you for passing this onto the Product Team.

I'm not sure what else I can tell you about the error, but I've attached a screenshot of it. The formula is being used in the OnSelect of my Import Data control.

It might be that I'm just using the control wrong, but there is little documentation on it and I've followed what is there as best as I can. Any suggestions or advice would be most welcome.

JoaoN
Helper IV
Helper IV

Any Update @v-xida-msft ??

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,087)