Google Sheets Query - use a reference cell to select which columns to select in a query - google-sheets-formula

I would like for a Google Sheets Query to choose which columns to select based on a cell reference. "select X" for example where the column header equals a cell that I reference. This is different from selecting which rows of a column to display. I want the Colx to be based on a cell reference.
Specifically, the data has different column headers with dates. I want the query to select the column that matches a particular date or any of the headers I may have in a drop down menu.
I used this format but it did not work
=query('Schedules'!A:N,"select A,B,C,D,E,K,H,J,L,M, '"&A2&"' WHERE N=1 and K !='HR(PD)' ORDER BY B,K",1)
This is the cell reference to the column I am looking for: '"&A2&"'
in A2 I have the letter of the column I want to use

Your current formula maybe a bit spotty with the quotes placement. You can see a working sample here:
=query(A:D,"Select A,"&F1&" Where A is not null")
based on header match
=query({A:D},"Select Col1, Col"&xmatch(F1,A1:D1)&" Where Col1 is not null")

Related

How to get index of the cell value in UiPath

I am trying to get the index of the cell value in an excel sheet using Uipath.
I have tried using Lookup range inside Excel application scope but its giving up the first similar value found in the Sheet as having duplicate values as well.
Please Suggest how we can find the the exact index Of the cell.
I have used
LookUp Range activity
Read Cell Formula
Col1 Col2 Col3
DB AB BB
AC DB AN
AK AB AC
I need to find the IndexOf value DB , located at Col2 2nd row
I would use a For-Each item in DB activity.
You can iterate through the lines and access the value with item(0).toString e.g⠀
Then you can go on and check up the location of your searched text.
If you run a counter with it, you can easy detecting the Row and Col number of your searched field.
If you want to lookup in column B alone then you can set range as "B:B" in the Lookup Range Activity.
It will search the value in Column B and give you the index found in the 2nd column.
enter image description here
1.Read the Excel it will stored in DAtatable DT
2.Use for each row in datatable
3.Use if condition inside the loop
currentrow(1).tostring. Contains(“DB”)
4.Take Assign activity
Var_Index(int Datatype) = DT.Rows.indexof(currentrow)
Its may be work….

Google Sheets SQL Query

I need your help in an SQL query in Google Sheets
I need a query to Select columns that have for example A1 in their name
My problem is that i have more than 150 columns that contain A1 in their title so a query like
query(range,"select D E F where .....") is not helpful as i need to write by hand more than 150 columns!!
So i need a query that either selects columns with certain string in their name or a sggestion to add a specific range in select claus
Here is an example image
and the link of my sample form https://docs.google.com/spreadsheets/d/1pYr1Rx0VasXjmAQC0qa9zNC_3rAdg_dxUKLy42zFTCY/edit?usp=sharing
Thanks in advance
try:
=TRANSPOSE(QUERY(TRANSPOSE(B3:M15), "where Col1 matches 'date|name|^A1.+'"))

How to check a checkbox in Apex 18 when its value is present in other table

I have a checkbox with list of values from table a. I need them to be checked if are present in a column of table b. Do you have any ready solution please colleagues ?
Thx
Adam
See this similar question for some background info.
When you're working with a multi-value checkbox item, you want your Source Query to select a colon-delimited list of the values that you want to be checked in your checkbox. (This is true for multi-value Application Express page items in general.) E.g.
select listagg(my_column, ':') within group (order by my_column)
from TableB
where my_column is the name of the column in TableB that your values are stored in.
If you have a lot of values in TableB (enough that the listagg() above returns more than 4000 characters), you'll need a fancier query, but for most cases it'll work fine.

Selecting oracle column header

I've been browsing and to no avail, I can't find any information on how to select/show only the column header. My objective is to select only column header . I've uploaded a picture for better illustration on my objective. In the picture shown, I'm trying to only select and display the one ive highlighted in the red box.
Oracle table:
The only information I found from the net is selecting an individual column, and with that. It will display the data as well which is not my objective. my main objective is to only select column headings.
In Oracle APEX SQL Workshop you can describe a table with this command:
desc table_name
If you're using a query, you can click on the "Describe" tab below the query and above the result grid.
I had a similar requirement, so in page designer I plugged in a "Where Clause = Sysdate-1"
you can use select and null to pick columns and use alias to name them
select null AS column_name,null AS column_name
from TABLE_NAME

SSRS sorting on a date field containing alphanumerics

I am using SSRS 3.0, and SharePoint 2013. I am sorting an SSRS report on a date field. I've used expressions to plug some of the dates as alphanumeric (ie “N/A”, “Ongoing”) The customer wants the rows sorted by date with the oldest dates first and the “N/A” and the “Ongoing” dates last. The Sort function is sorting the alphas first, then the other rows that contain dates. How do I get the Sort expression to sort the dates oldest to newest and then sort the “N/A” and “Ongoing” dates last? Thank you!
You can create a computed sort expression either in the SQL or in the report. I'll give an example of doing it in the report since that's what you asked.
First, go into your group properties and then the Sorting tab. We'll add two sorting conditions. Click the "Add" button and then click the expression button.
For the first condition, we'll separate the dates and the text. So the expression would be something like this:
=IIf(IsDate(Fields!MyColumn.Value), 1, 2)
Add a second sort condition and set it to sort your column in descending order. This will put the dates first and the text after it.
Separate the result set into two parts, one for the pure date result, and the rest for 'ongoing' & 'N/A'. Combine them using UNION.
Which will be the query like this:
Select col1, col2
From table
where ... --condition to filter out those rows with real date
order by date
UNION
Select col1, case when col2 ... then 'Ongoing' when col2 ... then 'N/A'
From table
where ... --condition to filter out those rows need to be replace with characters
--not necessary using `order by for this part`
You can simply use the ORDER BY clause as follows:
SELECT MyDate FROM MyDateTable
ORDER BY
CASE WHEN MyDate IN ('n/a','Ongoing') THEN 1 ELSE 0 END,
MyDate

Resources