cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
patty789
Helper V
Helper V

Using an API as a datasource

Hello,

 

I have a question regarding a column that has a table format. I am calling my API/datasource but when i use the following formula on a combobox: SAL.ProjectID(Label5.Text).elevations i get figure 1 as a result. How can over come this? or is there a better way to approch it. Figure 2 is how it shows up as the response. 

 

Figure 1

patty789_0-1607122201612.png

 

Figure 2

patty789_1-1607122257985.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@patty789 

Change your Items property to the following:

ForAll(
    Ungroup(
        SAL.ProjectID(Label5.Text).elevations,
        "elevations"
   ).Value,
   {id: ThisRecord.Value.id,
    number: ThisRecord.Value.number
   }
)

Should give you the type of records in a table that you want.  Ideally, your API should not return the records as an array, but if you have no control over that, then the above will resolve it.

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2

@patty789 

 

Which feature are you using? 

First we need to check which API you are already using to see if we could better advise you further. 

Is it the SalesForce Connector? Is that why you called it SAL? If so, please try about @RandyHayes  approach first, those are simpler approaches. Or if it is similar to that existing Connector, please try that first.

 

If the above is not the case, then to get more flexibility, and if this is not yet set up, you may need a Custom Connector instead which can support any API of any kind - but this is very advanced and may require a very detailed response to advise you on this one. You should always try the simpler approaches  such as @RandyHayes approach - use the following as a last resort as it advanced (but in your case it may turn out to be the only option - and if it is the only option, you must do both the below and then also @RandyHayes approach as well on top of it )

 

https://docs.microsoft.com/en-us/connectors/custom-connectors/

 

What we do know is that with the Custom Connector above, your scenario should be possible though.

 

As for what you are trying now, we would have to get more details on what you are trying now to see if it is possible there and see if we could attempt to better advise you about that one.

 

We currently have recent pending support ticket with Microsoft from one and a half months ago or so where new Custom Connector could not be created as the issue, where only the existing Custom Connector created previously works, but no new ones could be created from that time - and we are not sure if this was resolved yet in the meantime. So in case you were already going another route with a simpler feature, you should try to use that first. Otherwise, not only that issue would have to be checked on, but also, doing this is advanced and you would want to learn to do it, and a more detailed response may be needed as well.

 

The other scenario is that maybe you already have custom Connector to custom API. We could not really tell if this was your case - if it is, let us know. 

 

If @RandyHayes approach by itself works just use that and then please mark that post as accepted solution as well.

 

First try it with @RandyHayes  suggestion in short. However, that suggestion presumes you are already using a supported Connector to a data source of some kind - whether an existing one, or a custom one. If it is a custom API with no existing Connector, a Custom Connector must be created in that case to "use an API as a data source"

RandyHayes
Super User
Super User

@patty789 

Change your Items property to the following:

ForAll(
    Ungroup(
        SAL.ProjectID(Label5.Text).elevations,
        "elevations"
   ).Value,
   {id: ThisRecord.Value.id,
    number: ThisRecord.Value.number
   }
)

Should give you the type of records in a table that you want.  Ideally, your API should not return the records as an array, but if you have no control over that, then the above will resolve it.

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,238)