Slides Apps Script: PageElementRange not returning in same order as user's selection - google-apps-script

I'm working with Apps Script in Slides. The user can select multiple objects on the slide using Shift+Click, and I'm retrieving the selection with SlidesApp.getActivePresentation().getSelection().getPageElementRange().
However, I'm noticing that the order in which the user selects the shapes IS always correct when 2 objects are selected, but is often wrong when 3 or more objects are selected - the ordering with 3+ objects seems to be random and doesn't follow a pattern I can detect.
Any pointers here on how to get the order of the user's selection?

Looks like the pattern is their z-index order (stacking / layering order).
Would be useful to know their selection order, as well as their z-index order.

Related

Show no results if search box is empty using Filter Function on Google Sheets

I'm hoping somebody has a quick solution for me. I have a fantasy sport league setup on a google sheet. One of the sheets allows other people to search a database of players. Its broken down into four different search boxs offering the following search options: By Player, Position, Owner or Player designation. I'm using the filter function:
=filter(Sheet242!A2:E,search(B6,Sheet242!A2:A),search(E6,Sheet242!E2:E),search(B8,Sheet242!C2:C),search(E8,Sheet242!B2:B))
It draws from a table on a separate sheet.
This works great with one exception. It returns all the values in my table when all 4 search boxes have no value. I want it to filter no results if all 4 boxes are empty.
Here is a link to my google sheet so you can have a better visual of what im trying to do:
https://docs.google.com/spreadsheets/d/1XlfWyDOi-cEynVCcnWEpbOF7qIm_HlAKk2yG31rYvJw/edit?usp=sharing
The two sheets in question are "Player Database" and "Sheet 242".
Any suggestions would be greatly appreciated!
try:
=IF(LEN(B6&B8&E6&E8)=0,, FILTER(Sheet242!A2:E,
SEARCH(B6, Sheet242!A2:A), SEARCH(E6, Sheet242!E2:E),
SEARCH(B8, Sheet242!C2:C), SEARCH(E8, Sheet242!B2:B)))

Trying to crawl some data on Google Sheets but getting beat by XPath

I'm trying to make a sheet for study purposes on stock market, and I'm using this website to get the data from. Taking this stock as example.
My goals here are:
I want to grab some of the indicators from this div area (such as P/L, LPA, M. LÍQUIDA, and others);
And some of the numbers from this tables's first column (such as row 11, 15, and others).
My issues:
I'm not being able to fetch the data that I want from the div with the IMPORTXML function, neither with copying the XPath nor trying to find a specific class name to find a match.
I'm being able to fetch the specific number that I want, but it's returning 3 different values from 3 different rows (I want only the first one), due the XPath that I'm using //table/tbody/tr[11]/td[2]/span.
There's 2 more tables down the page that uses the same XPath, and the function is returning the values from row #11 of the other tables, as you can see here. The only thing that makes the 3 different from one another it's their divs, but I'm not being able to figure out how to manipulate these divs. There's any way to fix this or any function that automatically deletes the other 2 rows?
Can someone give me a light? :(
It's almost always easier to find the values you need by a reference. This should work to get the 20,76 from the first table
(//*[contains(text(), 'P/L')]/following::strong)[1]
As far as the second table goes, this should get 52.562,18 M
(//span[contains(text(), 'Receita Líquida')]/following::td)[1]
If you need to get different columns, you can just pass a higher index, this will return -0,07% for instance.
(//span[contains(text(), 'Receita Líquida')]/following::td)[5]
I also highly recommend getting some sort of xpath tester addon for your browser to play around with these if you don't already have one. I use ChroPath:
Firefox -
https://addons.mozilla.org/en-US/firefox/addon/chropath-for-firefox/
Chrome - https://chrome.google.com/webstore/detail/chropath/ljngjbnaijcbncmcnjfhigebomdlkcjo?hl=en-US

Embedded google drive ordering

Can we sort google drive files to show the newest or last modified ones on the top ?? I only can see the list and grid option for showing files in iframe. If not , any advice or alternative solution for this issue that my client is facing it ?
Here is the documentation you needed to list files from the drive.
This method accepts the q parameter, which is a search query combining
one or more search terms. For more information, see the Search for
Files and Team Drives guide.
And you can actually sort it by using the parameter orderBy.
A comma-separated list of sort keys. Valid keys are 'createdTime',
'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural',
'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and
'viewedByMeTime'. Each key sorts ascending by default, but may be
reversed with the 'desc' modifier. Example usage:
?orderBy=folder,modifiedTime desc,name. Please note that there is a
current limitation for users with approximately one million files in
which the requested sort order is ignored.
You can also test by Try it now.

selecting multiple items in an AS3 list component based on values

I've created a flash AS3 user form for sales people. When I create a user, I select multiple cities from a list component and drop them into an array. When added to the mySQL DB these entries are kept in a separte table which I can then call upon at any time using XML to bring them back into AS3. Now I'm using the same form as a user updaete form and populating it with data from previous MySQL insert.
My question is - How could I have these cities show as 'selected' on the list Component when the update form is loaded? Thus allowing the someone to add to or substract from that selection set. I'm trying to set selectedItems to match the ID's in the XML but failing miserably.
as a test I tried
addUser.citiesList.selectedItems = [3,4];
addUser.citiesList.selectedIndices = [3,4];
The selectedItems yield nothing but the selectedIndices works but I don't want to start matching indexes with Item ID's
looked all over but can't seem to find an answer. Am I missing something or is this not possible?
Well I finally got it working.
Having got the data out of the MySQL db, through PHP and into Flash as XML, I then pushed the user city values into a userCity array.
I got the AS3 list component in the form populated in the same way with all the cities.
I then used the userCity array in a nested for loop to inerate through all the cities in the list component, picking out the ones that had been previously selected and grabbing the index of each to pop into a new array which was the array used for the 'selectedindicies' and hey presto. I now have a cities list (about 36 cities) with the previously selected cities (about 5 cities) already selected and highlighted so that the user knows which cities the sales peson already manages. Now they can add or subtract from that and it will be picked up by my on change event as normal.
The Adobe resources on selectedIndices and selectedItems, for someone like me, who's learning is to say the least - pittyful...
I hope this helps someone else out...

Google Fusion Tables query (Google Map): add a Select All option in the drop-down filter

This question refers to a Google Map with a filter, created using the FusionTablesLayer Wizard.
Once a user has selected a filter value from the drop-down menu, the only way to revert back to the original map view (unfiltered, with all items showing on the map) is to refresh the whole page.
I'd like to add a "Select All" option to this query (or have it basically revert to select all if the user chooses the original "--Select--" option). I've seen a few similar scenarios, but despite my best efforts (which are pretty awful), I can't replicate the solutions!
Here's the code in jsFiddle: http://jsfiddle.net/j3GfP/
You need to replicate the original query (with no "where" clause) when the --Select-- ("") or VIEW ALL ("*") entries are selected:
http://jsfiddle.net/4vBFV/4/
(updated with correct link above)