Drop-down validation list created dynamically - validation

In range A1 I have a drop-down validation list. Based on the user's selection from that list I would like to dynamically create a new drop-down validation list in range C1.
For instance, in A1 the list contains:
A
B
C
So if the user selects A from the list, the new list in C1 contains:
1) Annoying Orange
2) Angry Birds
3) Arbitrary Sample
If the user selects B, the new list contains:
1) Bloated Code
2) Better Left Unsaid
3) Bad Attempt
etc
Easy enough to do using VBA. But in GAS.... I have absolutely no idea of how to even start :/

The Apps Script API for data validation was just released:
http://googleappsdeveloper.blogspot.com/2013/08/answering-another-top-request-data.html

You could follow the example in the accepted answer to Google spreadsheet Script Create Data Validation in certain range.
... up until last week, it would have worked. Unfortunately, the Data Validation class and related Range methods getDataValidation() and setDataValidation() have disappeared.
Your only avenue at this point is to visit Issue 2958 and star it, so you receive updates if & when the API is refreshed.

Related

Laravel backpack fields - select_from_array functionality

I am using laravel backpack. Have created a new Request form. Have created several fields to choose from using 'select_from_array':
$this->crud->field('range')->type('select_from_array)->label(__('number range'))
->options(Group::NUMBER_RANGE);
$this->crud->field('range1')->type('select_from_array)->label(__('letter range'))
->options(Group::LETTER_RANGE);
$this->crud->field('range2')->type('select_from_array)->label(__('symbol range'))
->options(Group::SYMBOL_RANGE);
For example, each field has got 3 dropdown values to choose from (to make it more clear, let's say number range has 1 / 2 / 3, then letter range has A / B / C, and symbol range has Sun / Moon / Wind).
I want to apply this functionality - if from number range I select 1, I want that letter range to show me just A and B (and C should disappear from the value choices), and symbol range show me just Wind. Or if I choose field letter range and I choose option value B I want that symbol range field would show me just Sun.
In general I want that fields would react with each other depending on the choices I made on the previous field the next field would show different options I could choose from.
How can I do this?
Thank you in advance :)
Backpack doesn’t currently make it easy to do that, but it doesn’t make it difficult either.
Option A - javascript
You can push a bit of javascript onpage, using the script widget, that will do whatever you want, including this functionality.
Widget::add()->type('script')->content('assets/js/admin/request_form.js');
There’s an active pull request trying to make it easier to interact with fields on the front-end too (PR #4312) but until that is merged, you can use vanilla JS or jQuery to do whatever you want.
Option B - select2_from_ajax
Alternatively, you could use the select2_from_ajax field type, which does allow you to do that using the “dependent” attribute. Since you’re in control of the AJAX endpoint, you can return different results depending on other form choices.
But:
I think making these 3 selects make AJAX requests is overkill, when a bit of JS can do the same for regular selects;
This is a PRO field, so it’s only available if you purchased the PRO addon;

Google Sheets getting Invalid error in drop down but item is on the list

In Google Sheets, I created a data validation cell to select different time slots. I am getting an error when choosing 6:00, 7:00, 8:00, 9:00 even tho all of them are in the list. Error says: "Invalid: Input must be an item on the specified list"
Added the data validation like this:
Thanks a lot in advance!
The file is here: https://docs.google.com/spreadsheets/d/1NSBx87sWScwe2Vtp9FOcH3BupvPJ_jzISUeAk6gSBOM/edit#gid=612415402
Make sure to actually pick a choice on the dropdown OR your input is exactly the same with the choice.
By default, when you manually enter 6:00-9:00 it automatically adds 0 in the beginning as sheets has detected your input as time.
So you should update your data validation list to use 06:00-09:00 instead so it matches when sheets adjusts your input when they are manually entered.

Reporting Multiple Values & Sorting

Having a bit of an issue and unsure if it's actually possible to do.
I'm working on a file that I will enter target progression vs actual target reporting the % outcome.
PAGE 1
¦NAME ¦TAR 1 %¦TAR 2 %¦TAR 3 %¦TAR 4 %¦OVERALL¦SUB 1¦SUB 2¦SUB 3¦
¦NAME1¦ 114%¦ 121%¦ 100%¦ 250%¦ 146%¦ 2¦ 0¦ 0%¦
¦NAME2¦ 88%¦ 100%¦ 90%¦ 50%¦ 82%¦ 0¦ 1¦ 0%¦
¦NAME3¦ 82%¦ 54%¦ 64%¦ 100%¦ 75%¦ 6¦ 6¦ 15%¦
¦NAME4¦ 103%¦ 64%¦ 56%¦ 43%¦ 67%¦ 4¦ 4¦ 24%¦
¦NAME5¦ 87%¦ 63%¦ 89%¦ 0%¦ 60%¦ 3¦ 2¦ 16%¦
Now I already have it sorting all rows by the Overall % column so I can quickly see at a glance but I am creating a second page that I need to reference points.
So on the second page I would like to somehow sort and reference different columns for example
PAGE 2
TOP TAR 1¦Name of top %¦Top %¦
TOP TAR 2¦Name of top %¦Top %¦
Is something like this possible to do?
Essentially I'm creating an Employee of the Month form that automatically works out who has topped what.
I'm willing to drop a paypal donation for whoever can figure this out for me as I've been doing it manually every month and would appreciate the time saved
I don't think a complicated array formula is necessary for this - I am suggesting a fairly standard Index/Match approach.
First set up the row titles - you can just copy and transpose them from Page 1, or use a formula in A2 of Page 2 like
=transpose('Page 1'!B1:E1)
The use them in an index/match to get the data in the corresponding column of the main sheet and find its maximum (in C2)
=max(index('Page 1'!A:E,0,match(A2,'Page 1'!A$1:E$1,0)))
Finally look up the maximum in the main sheet to find the corresponding name:
=index('Page 1'!A:A,match(C2,index('Page 1'!A:E,0,match(A2,'Page 1'!A$1:E$1,0)),0))
If you think there could be a tie for first place with two or more people getting the same score, you could use a filter to get the different names:
So if the max score is in B8 this time (same formula)
=max(index('Page 1'!A:E,0,match(A8,'Page 1'!A$1:E$1,0)))
the different names could be spread across the corresponding row using transpose (in C8)
=ArrayFormula(TRANSPOSE(filter('Page 1'!A:A,index('Page 1'!A:E,0,match(A8,'Page 1'!A$1:E$1,0))=B8)))
I have changed the test data slightly to show these different scenarios
Results

App Inventor TinyWebDB List Problems

I got a problem using the TinyWebDB in App Inventor 2. Here's a Screenshot of the blockcode.
The goal of this Screen is to store a list(array) of images and later query them with a button but my problem starts already earlier. First there is a variable initialized called fotoList and declared as an empty list.
When this Screen initializes (left block) I store the empty fotoList under the tag FotoListTag. Then if the image under the tag "SteckbriefFoto" is not in this list -> getValue with tag "FotoListTag". Then he jumps into the block on the right and adds the photo .. other stuff not important .. at the end I store the list again in the TinyWebDB (and also in the TinyDB) with the tag "FotoListTag". Then it goes back to the block on the left where at the end I want to set an image.picture to the photo I stored in variable fotoList.
When I compile the code there is an error opening the page that says
Select list item: List index too large
Select list item: Attempt to get item number 1 of a list of length 0:()
I just don't get the problem with this code and i hope someone can help me.
For lists, valueIfTagNotThere should be create empty list instead of an empty string
On first run of your app, TinyDB is empty, which means, for tag = FotoListTag you get no value back, therefore this should be an empty list in the beginning.
Later you are trying to select the first item from the list (zahl is 1). As you know, the list is empty in the beginning, so probably you should add an if statement to check, if the list is not empty and only then select the first item... same for tag = Schriftlist.
You also have a timing issue. in Screen.Initialize you are trying to get a value from TinyWebDB. This is an asynchronous call, you get the result back in TinyWebDB.GotResult event and this takes a little bit (let's say 500 milliseconds), but meanwhile the complete blocks of the Screen.Initialize event will be executed. Probably you are expecting, that meanwhile tag = FotolistTag is not empty anymore, but this is not the case.

Import XML google spreadsheet is not working Properly

find attached link for my Google spreadsheet in which i tried to pull out the data from booking.com.
i retrieved Hotel name in column. it successfully retrieved the hotel name. but not work with every column. Output is like this.
even i referenced the formula correctly. but it automatically changed to like this..=CONTINUE(E1, 2, 1)
red highlighted cell is having problem. look there.
Please find below link for your reference. Thanks in Advance.
https://docs.google.com/spreadsheet/ccc?key=0AtjX3Ttg50IydHJzR1FMSkJyY0U1bHBSeWtrMDRSZ1E
The formula in E1:
=ImportXML(D1,"//div[#id = 'wrap-hotelpage-top']/h1[#class='item']/span")
is returning a 2 x 2 array. To return just the top left-cell and avoid population of the CONTINUE functions (so that you can fill down successfully), use
=INDEX(ImportXML(D1,"//div[#id = 'wrap-hotelpage-top']/h1[#class='item']/span");1;1)

Resources