Google Sheets: VLOOKUP and Transcribing data based on multiple categories in the same column - arrays

I'm trying to use vlookup between two tabs in a sheet where the data that exists in a single column denoted by "type" (tab B) needs to be transcribed into separate columns by type (tab A).
Edit:
For example, tab B has the "raw" data listed in just three columns: the type, the ID, and the value.
I would want tab A to be able to pull from tab B but organize it by the ID, then by the value associated with the type following it.
So, tab A would vlookup according to the ID, and then pull the associated value according to the column name (type): aaaaaa, bbbbbbb, ccccccc
Column Headers would be: ID, aaaaaa, bbbbbbb, ccccccc
and then the associated data will be filled out according to the ID and type match
I've only done vlookup where the filter is by what exists on tab A to trigger what to pull in tab B
=if((F236="aaa",VLOOKUP(A236, "TabName!$A$4:$AC"),24,FALSE), if(F236="bbb",VLOOKUP(A236,"TabName!"),24,FALSE))
I've attached a sample of how the two tabs have been set up for reference! Thank you!
sample sheet

try:
=QUERY('sample database (tab b)'!A2:C,
"select B,max(C)
where B is not null
group by B
pivot A
label B'ID'")

Related

Combobox based on a lookup field - how to appear another columns

I have an issue on a combobox on PowerApp based on a lookup field. In access, it is something more than easy but in PowerApp it seems like going to the moon...
I have a List A in which one of the columns (TblA_ColumnA) is a lookup fields based on List B. On sharepoint List definition setup, the lookup fields shows TblB_ColumnA.
In the table B, I have others columns.
When I create the form, for this specific fields, I see on the combobox the value indicated into tblB_ColumnA.
I want to see others columns of List B and not this one. For exemple the Column B of List B.
-Actual DataCard:
Default= ThisItem.TblA_ColumnA Update= DataCarValue64.Selected
-Actual Combobox
Items= Choices([#ListA].TblA_ColumnA) DisplayFields= ["Value"] DefaultSelectedItems=Parent.Default.
Please help me.
Thanks,
BR,
Damien
I tried to change the item putting a filter on List B but nothing works;

extracting name/value pairs into columns and values - Shopify Data In Bigquery

We use FiveTran to extract our data from shopify and store it in BigQuery. The field "properties" within the order_line table contains what looks like an array of key/value pairs. In this case name/value. The field type is string here is an example of the contents
order_line_id properties
9956058529877 [{"name":"_order_bump_rule_id","value":"4afx7cbw6"},{"name":"_order_bump_bump_id","value":"769d1996-b6fb-4bc3-8d41-c4d7125768c5"},{"name":"_source","value":"order-bump"}]
4467731660885 [{"name":"shipping_interval_unit_type","value":null},{"name":"charge_delay","value":null},{"name":"charge_on_day_of_week","value":null},{"name":"charge_interval_frequency","value":null},{"name":"charge_on_day_of_month","value":null},{"name":"shipping_interval_frequency","value":null},{"name":"number_charges_until_expiration","value":null}]
4467738738773 [{"name":"shipping_interval_unit_type","value":null},{"name":"charge_delay","value":null},{"name":"charge_on_day_of_week","value":null},{"name":"charge_interval_frequency","value":null},{"name":"charge_on_day_of_month","value":null},{"name":"shipping_interval_frequency","value":null},{"name":"number_charges_until_expiration","value":null}]
4578798600277 [{"name":"shipping_interval_unit_type","value":null},{"name":"charge_interval_frequency","value":null},{"name":"shipping_interval_frequency","value":null}]
I am trying to write a query that generate one row per record with a column for each of these name values:
shipping_interval_unit_type
charge_on_day_of_week
charge_interval_frequency
charge_on_day_of_month
subscription_id
number_charges_until_expiration
shipping_interval_frequency
and the corresponding "value". This field "properties" can contain many different "name" values and they can be in different order each time. The "name" values noted above are not always present in the "properties" field.
I've tried json functions but it doesn't seem to be properly formatted for json. I've tried unnesting it but that fails since it is a string.
Consider below approach
select * from (
select order_line_id,
json_extract_scalar(property, '$.name') name,
json_extract_scalar(property, '$.value') value
from your_table, unnest(json_extract_array(properties)) property
)
pivot (min(value) for name in (
'shipping_interval_unit_type',
'charge_on_day_of_week',
'charge_interval_frequency',
'charge_on_day_of_month',
'subscription_id',
'number_charges_until_expiration',
'shipping_interval_frequency'
))

How to query specific information from a JSON column?

I have searched Stack Overflow to get an answer to my question, but while I found many interesting cases, none of them quite address mine.
I have a column called fields in my data, that contains JSON information, such as presented below:
Row Fields
1 [{"label":"Label 1","key":"label_1","description":"Value of label_1"},{"label":"Label 2","key":"label_2","error":"Something"}]
2 [{"description":"something","label":"Row 1","key":"row_1"},{"label":"Row 2","message":"message_1","key":"row_2"}]
In essence, I have many rows of JSON that contain label and key, and bunch of other parameters like that. From every {}, I want to extract only label and key, and then (optional, but ideally) stretch every label and key in every {} to its own row. So, as a result, I would have the following output:
Row Label Key
1 Label 1 label_1
1 Label 2 label_2
2 Row 1 row_1
2 Row 2 row_2
Please note, contents of label and key within JSON can be anything (strings, integers, special characters, a mix of everything, etc. In addition, key and label can be anywhere in relation to other parameters within each {}.
Here is the Big Query SQL dummy data for convenience:
SELECT '1' AS Row, '[{"label":"Label 1","key":"label_1","description":"Value of label_1"},{"label":"Label 2","key":"label_2","error":"Something"}]' AS Fields
UNION ALL
SELECT '2' AS Row, '[{"description":"something","label":"Row 1","key":"row_1"},{"label":"Row 2","message":"message_1","key":"row_2"}]' AS Fields
I have first thought of using REGEX to isolate all the brackets and only show me information with label and key. Then, I looked into BQ Documentation of JSON functions and got very stuck on json_path parameters, specifically because their example doesn't match mine.
Consider below approach
select `row`,
json_extract_scalar(el, '$.label') label,
json_extract_scalar(el, '$.key') key
from your_table, unnest(json_extract_array(fields)) el
if applied to sample data in your question - output is

Is it possible to nest values based on key column in AppSheet?

I have a table connected to AppSheet that has a column called "Names" there are many values that have the same name with different information. Is there anyway in AppSheet to have the user tap on one name and have all of the values show up that have the same Customer name. Essentially grouping.
I know there is a community on Google Plus for AppSheet but it doesn't seem very active my question has been sitting on the site for weeks. If anyone needs more clarification please ask.
Not very clear what you are trying to achieve, but you can correct me if I'm wrong.
You want in the Inline view of any given Customer, to have a list of referenced values.
You can do this with a SELECT() function. In Data > Columns > + "Virtual column"
In the "App formula" input add your function.
For example: SELECT( myTable[myColumn], [Name] = [_THISROW].[Name])
What this does:
List all values from column named "myColumn" in table "myTable"
where "Name" has the same "Name" as this row,
https://help.appsheet.com/expressions/functions/select
If you want to list not only values but a list of referenced rows from another table, you should use REF_ROWS.
For example REF_ROWS("myOrdersTable", "orderCustomer")
What this does: list all rows from table named "myOrdersTable" where column named "orderCustomer" has the same value as the unique KEY of this row.
REF_ROW virtual columns are generated automatically when you give a "REF" type to any column. In this example if you go to Data > Columns > "myOrdersTable" and change the type of "orderCustomer" to "REF" with "ReferencedTableName" to "myCustumerTable", a virtual column with list of referenced rows will be generated in "myCustumerTable" table after you save.
https://help.appsheet.com/data/references/references-between-tables

Google Sheet Index?

I have a dropdown list on Google Sheets, column A. Depending on what option is selected, I need column B to show the associated value. I tried using the INDEX functions but I am not sure I get it on how to use it, as to me is the same as using "=" to a specific cell. Basically I need to associate values:
COLUMNS:
A B
ORANGES = VERY GOOD
APPLES = yuck!
BANANAS = NICE!
So if on column A, "APPLES" was selected from the dropdown list, the column B should show the associated value for that option ("yuck!").
I actually found a solution, using Nested IF'S,
=IF(A1="ORANGES","VERY GOOD",IF(A1="APPLES","YUCK!",IF(A1="BANANAS","NICE!")))
add as many if statements as needed

Resources