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

Re-create dynamically a collection (using a custom API and not knowing the structure in advance)

Hi,

I'm building an app where I request for a set of data using a custom API (TestConnection).
I successfully get back data and assign them to collections without knowing the structure in advance.

But is it possible to create dynamically a collection that has the same structure? I can have the same result if I know the structure in advance (I just create the same fields inside a ClearCollect, as the structure of swagger) but what are the chances to get it automatically?


From DataBase

ClearCollect(CollLine, TestConnection.CollLineGetAllCollLines())

 

Capture.PNG

 

Manually:

Collect(CollLine, {Name: LDescriptionInput_2.Text, WorkType: WTDropdown1.Selected.WorkType,  StartTime: StartTimeInput_2.Text, EndTime: EndTimeInput_2.Text, TotalTimeH :hours, TotalTimeM : minutes, Project: ProjectDropdown_2.Selected.PName, DayField: DayFieldDropdown_2.Selected.MyDay, WeekField: WeekFieldDropdown_2.Selected.WRName, Comments:NotesTextInput.Text }); UpdateContext({showDialog:true}); UpdateContext({hourflag: ETDropdown.Selected.h, minflag:ETDropdown_.Selected.m}); 

 

2 REPLIES 2
v-micsh-msft
Community Support
Community Support

Hi @christinadot,

 

I am a little confused about "Re-create dynamically a collection" here.

If you use Custom API, the data structure should have been defined already within the swagger.

And the "From Database" formula you used here should be the right formula to create the collection.

 

By saying dynamically, do you mean to get the Collection structure without the data from the Custom API?

Based on what I know, there is no available ways.

Please post back if I have anything misunderstood.

 

Regards

Michael Shao

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-micsh-msft,

 

Right. By saying dynamically, I meant to get the Collection structure without the data from the Custom API in order to use the same method for many cases & structures and not have to write the fields one by one.

It's a pitty that we cannot have it but any case, we can write the function, is not really a big deal.

 

Thank you very much for your response.

 

Best,

Christina

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (20,565)