cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
seadude
Level 10

Number Table and ForAll

Hi @RandyHayes ,
The other day we were hacking on a Number Table / ForAll solution. I'm now trying to repurpsoe that Number Table for other uses.

Goal:

  • Grab a series of images from the Azure Maps API based on all available Zoom levels.
  • There are 20 zoom levels, 0-20. 

Tried:

  • Take the first 20 numbers of the Numbers Table and slap them into the Zoom parameter of the API call to perform this.
  • ClearCollect(colEarthquakeMap,
        ForAll(colNumbersTable,
            If(number <= 20,
                azureMapTimezone.GetMapImageWithPins(
                    1.0,
                    600,
                    600,
                    {
                        zoom: number,
                        center: Concatenate(Text(Location.Longitude), ",", Text(Location.Latitude)),
                        pins: Concatenate("default||", Concat(colEarthquakeLatLongs, long & " " & lat, "|")),
                        path: Concatenate("ra300000||", Text(Location.Longitude), " ", Text(Location.Latitude))
                    }
                )
            )
        )
    );
    • Anticipated Result: Take the first 20 numbers of the Numbers Table and use them as both the Count of "Things" to Collect AND the Zoom level.
    • Results: A Collection of 1000 results (entire Numbers Table), with the same image zoom level (zoom level 0) for each.

At a glance, can you spot a direction to take here?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Number Table and ForAll

How about the following?

The lines in bold are the ones I've altered. Put a filter on colNumbersTable so you are only iterating the 20 numbers you need. I've also cleared the colEarthquake map collection first, then collected into it line by line as I've used that method before, but not the ClearCollect method in your sample.

I'm assuming your number table starts from 1, otherwise modify the filter accordingly.

 

Clear(colEarthquakeMap);
    ForAll(Filter(colNumbersTable, number<=20),
        Collect(colEarthquakeMape,
            azureMapTimezone.GetMapImageWithPins(
                1.0,
                600,
                600,
                {
                    zoom: number,
                    center: Concatenate(Text(Location.Longitude), ",", Text(Location.Latitude)),
                    pins: Concatenate("default||", Concat(colEarthquakeLatLongs, long & " " & lat, "|")),
                    path: Concatenate("ra300000||", Text(Location.Longitude), " ", Text(Location.Latitude))
                }
            )
        )
    )
);

View solution in original post

11 REPLIES 11
Super User
Super User

Re: Number Table and ForAll

@seadude 

At a glance this looks legit.  Have you tried it out?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Super User
Super User

Re: Number Table and ForAll

How about the following?

The lines in bold are the ones I've altered. Put a filter on colNumbersTable so you are only iterating the 20 numbers you need. I've also cleared the colEarthquake map collection first, then collected into it line by line as I've used that method before, but not the ClearCollect method in your sample.

I'm assuming your number table starts from 1, otherwise modify the filter accordingly.

 

Clear(colEarthquakeMap);
    ForAll(Filter(colNumbersTable, number<=20),
        Collect(colEarthquakeMape,
            azureMapTimezone.GetMapImageWithPins(
                1.0,
                600,
                600,
                {
                    zoom: number,
                    center: Concatenate(Text(Location.Longitude), ",", Text(Location.Latitude)),
                    pins: Concatenate("default||", Concat(colEarthquakeLatLongs, long & " " & lat, "|")),
                    path: Concatenate("ra300000||", Text(Location.Longitude), " ", Text(Location.Latitude))
                }
            )
        )
    )
);

View solution in original post

Highlighted
seadude
Level 10

Re: Number Table and ForAll

Excellent! This totally works, thanks @PaulD1 .

Clear(colEarthquakeMap);

    ForAll(Filter(colNumbersTable, number<=20),
        Collect(colEarthquakeMap,
            azureMapTimezone.GetMapImageWithPins(
                1.0,
                600,
                600,
                {
                    zoom: number,
                    center: Concatenate(Text(Location.Longitude), ",", Text(Location.Latitude)),
                    pins: Concatenate("default||", Concat(colEarthquakeLatLongs, long & " " & lat, "|")),
                    path: Concatenate("ra300000||", Text(Location.Longitude), " ", Text(Location.Latitude))
                }
            )
        )
    );

Now I'm going to figure out how to apply an ID column and id to each record. Stay tuned!

Super User
Super User

Re: Number Table and ForAll

@seadude 

Sorrya bout that...I totally missed your sentence about the results you were getting.  Thought you were just looking for a "concept" confirmation. LOL...it's been one of those days!

Good call @PaulD1 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
seadude
Level 10

Re: Number Table and ForAll

All good 🙂 !
K. I got the ID column applied to all returned map images. Last step is to apply a "pseudo - zoom" effect.

Heres a stumper:

  • If the collection of images looks like this (with the "Url" being the next level under "mapImage" in the Col)
    • image.png
  • How come setting an Image control to:
    • LookUp(colEarthquakeMapsWithIds, id = slider.Value, mapImage.Url) does NOT work!
  • I've tried First(Lookup...).Url).Url, etc... The best I can do is showing the First image in the Collection with the slider having no effect.
  • The errors all seem to be: image.png

Thought I was becoming a nested- data guru... !

seadude
Level 10

Re: Number Table and ForAll

ClearCollect(wtf,
Ungroup(Filter(colEarthquakeMapWithIDs, id = varZoom),"mapImage")
)

Results in:

image.png

Bizarre. Its like the Filter() isn't being respected. There is only 1 record with id = 10.

Super User
Super User

Re: Number Table and ForAll

@seadude 

Did you get any further on this or are you still struggling with it?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Super User
Super User

Re: Number Table and ForAll

Hi @RandyHayes , 

Still struggling. I cannot for the life of me figure out why...

  • Slider Control
    • Min: 0
    • Max: 10
    • OnChange: Set(varZoom, Slider.Value)
  • Image Control, Image property set to:
LookUp(colEarthquakeMapWithIds, id = varZoom, mapImage.Url) // also tried...

First(LookUp(colEarthquakeMapWithIds, id = Slider.Value, mapImage.Url).Url).Url // and all variations imaginable.

Expecting

  • The image to change based on the slider. 

Results:

  • The image either has an error saying "Table values, expecting image..." or Its the first image in the Collection no matter the Slider Value.

The collection details are shown above... Can you see anything glaring?

Super User
Super User

Re: Number Table and ForAll

@ericonline 

So looking at your pictures of the collection, it appears that Url is a table.  What does the structure of that table look like?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,883)