Map view configured to display a user-input slice

Hi, Folks!
I have several views configured which depend upon slices I have defined. I would like a single map view to display only the data for the view chosen by the user. Is there some way to configure the map view (either the system generated one or a custom one) so that it only displays the addresses for the given view?

Said another way, I would like to be able to configure the map view in such a way that it automatically reads the particular view chosen by a user instead of configuring it to a fixed slice in the view definition.

Does that make sense? And is it possible?

1 Like

@Steve, first of all, thanks so much for taking the time to look at my questions. I should, perhaps, also point out that I have only been experimenting with appsheet for around 6 or 8 weeks now. (I must confess that I feel like I am trying to thread a needle using a 5-pound sledge hammer while the needle is moving! I’m in the classic position of the ignorant student: I just don’t know what I don’t know!) However, I am enormously impressed with the platform and the terrific support you folks provide. I am hoping to solve these little details so that I can propose we deploy the app I am writing for our sales team.

So, I have a master list of customers. Appsheet, during its initial creation of the app, configured a map view (primary view) showing the addresses of all those customers. Ok, perfect! Now, I defined a slice of the master list so that it would show only the customers in a particular region and then defined a view (which I put in the menu) to use that slice.

What I would like to have happen is, when I choose the slice and then choose the map view at the bottom of the screen, the map view only shows the addresses of the customers in the slice. It seems to me that I have to find a way to tell the map view to only use the addresses from this slice. But I don’t see a way to do that since the map view is fixed to one particular slice and you can’t enter an expression.

Using CONTEXT() I can get the map view to appear or disappear, depending on the slice chosen, but I cannot alter (or filter) the column of addresses based on the view. It is always tied to the master list of customer addresses.

There is probably an obvious answer to this (or it is not possible for the way I have structured the data) but I am not seeing it, either way.

Thanks again, @Steve, for having a look at this.

We’ve all been there! AppSheet has a definite learning curve!

A simple approach would be to delete the map view AppSheet created, or move it to the menu. Then reconfigure the map view you created that uses the slice to put in the primary position. In other words, swap the positions of the two map views.

1 Like

So, does that mean I need to create a map view for each slice? I was hoping there was a relatively straightforward way of automating the map view based on the chosen slice. Maybe that’s what you’re giving me but I don’t understand yet. I can’t see how to use CONTEXT() to accomplish it.

Sorry. I don’t mean to seem so dense. I’ll keep studying this and try to learn more.

A view can only be attached to a single data set, so if you want the view to adapt, the data set must adapt. You can try using CONTEXT() in a slice’s Row filter condition expression. The one time I tried doing that (because it really is a neat idea!), it caused crippling performance problems, so I abandoned the effort.

1 Like

How does a user “select a slice” in your app?

Are you wanting to “filter” on the region? Do you want your users to select a region, then see a map of all customers in that region?

So, I think that was slowly seeping into my concrete brain as I was puzzling on this over the weekend. My real problem with getting this to work was trying to get a view to do what I should have been trying to do in a slice. Once I latched on to that piece, I made some progress - I actually got it to work - but more by accident than design. I had an additional problem with how I was ordering the ANY() expression in the slice. I don’t fully understand why what I wrote was incorrect but, once I reversed the terms on either side of the equal sign, my slice worked like a champ. I still need to experiment with it to make sure I understand why it works - but, as I said, I made some progress.

Thanks, Steve. I wasn’t able to use your suggestions directly but your input helped me to organize my thinking a bit. I have a long way to go yet but the app is actually pretty functional right now, which is immensely satisfying!

1 Like

Hi, Marc.

Yeah, good question. I think the answer to that question was at the root of my difficulty. You can see the response I sent to Steve but, essentially, I was trying to make a view perform the functions of a slice. Initially, I hard-coded the slice to a specific region excerpted from a master list of customers just to make sure the view worked. I stumbled, though, when I was trying to make the input to the view variable. Instead, I should have been looking at making the slice variable based on user input. I was able to use an example app (“Slice based on user input”) to help me sort through what to do. As i said to Steve, I don’t fully understand what I am doing yet, but the app I wrote works and I am making some progress learning how to manipulate all of this.

Thanks for taking a minute to offer help, I really appreciate it!

1 Like

Perhaps you ran into The Quirk!

https://community.appsheet.com/search?q=@steve%20quirk

Well, I’m not sure!

The filter expression I wrote, ANY([SALES ROUTE])=AREAS[Rte], did not produce any results. But, when I wrote ANY(AREAS[Rte])= [SALES ROUTE], it suddenly worked fine. [SALES ROUTE] is a column in the table CUSTOMERS (the master list of customers) while [Rte] is a column in the table AREAS, which is a table I am using to create a drop-down list of choices to apply as a filter. I have a form which gives the user the ability to select from that drop-down list (using the “quick edit” feature) to create a filtered view of customers in a particular area.

I don’t fully understand why the former equation didn’t work while the latter did but I am sure it has to do with understanding the syntax of writing expressions, in general, and using the ANY() expression, in particular.

It’s a bit of progress, anyway, that let’s me build and move forward. Seems like there might actually be a light at the end of that proverbial tunnel, albeit shrouded in fog and a long way off! Holding my breath it ain’t a train coming my way!

1 Like

Ah, okay!

[SALES ROUTE] is a reference to the value of the SALES ROUTE column of the current row. Given that the column name is singular (route vs. routes), I’m going to guess that column of a row contains only a singular value, not a List or EnumList of possibly-multiple values.

The ANY() function, when used on a List or EnumList of values, produces only the first value from that list. I’ve never tried using ANY() on a singular value, but it appears you did and didn’t get an error. I’d then assume that in that case ANY() simply produced the singular value it was given.

AREAS[Rte] is a table-column reference (AREAS being the table, Rte being the column). Used as you did, a table-column reference produces a List of the values from the given column (Rte) from the given table (AREAS). This is not a singular value; it is a list of values.

ANY([SALES ROUTE])=AREAS[Rte] compares a singular value (ANY([SALES ROUTE])) to a list of values (AREAS[Rte]). This doesn’t appear to be what you want to do.

When you rewrote it as ANY(AREAS[Rte])= [SALES ROUTE], you compared a singular value (ANY(AREAS[Rte])) to a singular value ([SALES ROUTE]), which is closer to what you want to do.

See also:

Once again, I humbly appreciate your generosity of time explaining this to me. Although I grasp your explanation on a “surface level,” so to speak, I’ll need to study it some and experiment with the expressions before I can say I really understand it.

As long as I have touched on that subject, do you recommend any particular training courses / literature for a novice who is interested in becoming competent enough to be a developer? I have watched (and am re-watching) a video on Udemy. I would be interested in a systematic course, though, that might take me from novice to expert. Any thoughts you have would be much appreciated.

Thanks.

Unfortunately, I have no recommendations. I learned AppSheet myself by reading a lot of help docs, participating in the community, and lots of trial and error. @MultiTech_Visions has a lot of videos that were very, very helpful for me, too.

3 Likes

@Steve you’re too kind :blush:

1 Like

I second this :+1:

1 Like