Am building an application with oracle apex 5 where i want the user to chose multiple parameters and returning an interactive report based on the parameters selected by the user.
One of the parameters is a list manager item where the user select multiple values to be passed to an SQL query.
my problem is how to pass those values to the sql query, the item type is list manager and the name is P2_OPTIONS how do i pass the parameters to the SQL query generating the report.
Selected values storing in P2_OPTIONS divided by colon, for example 2:7:17.
So, you can insert this string into your query, preliminary replacing colon to comma and get expression like
...
and parameter0 in (2,7,17)
...
OR
you can parse this string into apex collection and join this collection in you query
...and apex_collections.collection_name = 'P2_OPTIONS_PARSED'
and parameter0 = apex_collections.c001
...
Related
I was wondering if there is a way to add a list of "permitted values" to a parameter in Data Studio by using a custom query / BigQuery connector?
There is an option to do it manually in the Data Studio UI:
Permitted values through Data Studio UI
But I am looking for a solution to do it through SQL because I have to pass a long list of values that can be changed every day, so adding a list of values manually through the UI is impossible.
Is it possible to do it through a custom query?
Thank you!
You do not need a custom query to define allowed Values if you want to Filter for them just set them up as a Dimension and add a Filter Control with an drop-down List. This will allow you to select the present Values and filter for them.
Let me know if this solves it for you
You can add parameters to a custom SQL query in the connector, just like the following examples show
SELECT word FROM `TABLE` WHERE corpus = #corpus;
Use a string with contains and a number:
SELECT * FROM `bigquery-public-data.baseball.games_post_wide`
WHERE REGEXP_CONTAINS(gameId, #s)
AND attendance > #attendance LIMIT 100;
Use a multi-select string parameter. Note the use of UNNEST to flatten the list of values:
SELECT * from user.users as user WHERE display_name in UNNEST(#name);
Date parameter example:
SELECT creation_date, age, display_name from user.users as user
WHERE creation_date > PARSE_DATE('%Y%m%d', #DS_START_DATE)
AND creation_date < PARSE_DATE('%Y%m%d', #DS_END_DATE);
Email parameter example:
Select * from Sales WHERE sales-rep-email = #DS_USER_EMAIL;
Here you can read more about using parameters in Data Studio
I have an IFrame which shows a PowerBI embedded Report that shows a list of Accounts.
I want to pass in an Account ID so that I only see the sales for my Account.
In side the report I have a Table lets say in called Query1 and Inside that table I have a field called AccountID. I need to add to my URL to filter the Accountid = 123.
My URL is something like this....
https://app.powerbi.com/reportEmbed?reportId=xxxxxxxxxxxx&autoAuth=true&ctid=xxxxxxxxxxx-xxxxxxxxx&config=eyJjbHVzdGVyVXJsIjoiaHR0cHM6Ly93YWJpLXdlc3QtZXVyb3BlLXJlZGlyZWN0LmFuYWx5c2lzLndpbmRvd3MubmV0LyJ9
What exactly should I add to filter the report by the AccountID?
You should add url parameter called filter. You need to specify table and field you want to filter and add value of the filter after eq. So your end result should be something like that:
URL?filter=Table/Accountid eq 123.
Here's Microsoft documentation about it https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-url-filters#query-string-parameter-syntax-for-filtering
Update top part of course works for filtering reports in the appor work space itself. To filter embedded report you need to specify the page and filter in a similar fashion for the embedded link https://learn.microsoft.com/en-us/power-bi/collaborate-share/service-embed-secure. So you link will be something like that:
https://app.powerbi.com/reportEmbed?blabla&pageName=Page1&$filter=Table/Accountid eq 123
Here how it would like once embedded:
Suppose there are 3 Reports in an Oracle Apex page and I want to search all the columns of all the reports to get the matched string that the user will search. Any ideas?
Create your own search item; let's call it P1_SEARCH. Modify all reports' queries and add condition into their WHERE clauses, e.g.
select ...
from ...
where ...
-- add this:
and ( (column_1 = :P1_SEARCH or
column_2 = :P1_SEARCH or
...
)
or :P1_SEARCH is null
)
Columns you'd use should make sense (i.e. there's no use in searching DATE datatype columns for "Ashi", is there?).
Looking at what you should do (using that suggestion, of course), I'd say that it is simpler to use Apex engine and search 3 times, report-by-report.
I'm making a Microsoft Access table where one of the fields is a list of pre-made options. When I make a SQL query on that table it returns the values of the list as strings containing the spelled out choice. I would like to assign numerical values to each element of the list so a SQL query returns a number instead. How do I do this? I know it's possible because I have an access file with such a list but I'm unable to recreate it.
An easy way to do this is to have your combo box use a query of the table as a Rowsource. This query would have the table unique ID in the first field and the field you wish to return as the second field. Then change the setting on the combo box for "Column Count" to 2. If you want to show both fields change the "Column Widths" value to 1"; 1". If you want to show only one field, change the value of one you do not want to see to 0. Now we you refer to this list in an SQL queries, it will use the ID field but show the user the string field.
We are populating a subregion of a page with an Iframe (call to another page) with data for a questionnaire.
We have PAGE ITEM variables (:P37_... populated by query) that contain table values for P37_QUESTION_DESCRIPTION and P37_RESPONSE_TYPE.
The sub page used in the region (:P28_...) assigns report attributes for each column... where We populated the question text in the P28_QUESTION_DESC and a Y/N Select List defined list of values in the P28_RESPONSE_DESC_DISPLAY column. This works fine.
Now, the P37_RESPONSE_TYPE can more than just this Y/N Select List. It could be TEXTAREA, PICKLIST, DATE...
How can we define the :P28_RESPONSE_DESC_DISPLAY column dynamically to be any number of user input field types (based on the value in :P37_REPSONSE_TYPE?)
This was solved by using a non-tabular form report generated by query using apex.item functions. But is has left me with another problem. Here's the query:
select
apex_item.hidden(31,CASE_QUEST_DTL_ID) CASE_QUEST_DTL_ID,
apex_item.hidden(32,CASE_MGMT_BASE_ID) CASE_MGMT_BASE_ID,
apex_item.display_and_save(33,to_number(question_seq_no)) QUESTION_SEQ_NO,
apex_item.display_and_save(34,question_desc) QUESTION_DESC,
case when response_type = 'PICKLIST-YESNO' then apex_item.select_list_from_lov(35,response_desc,'YES_NO_SELECTLIST',NULL,'NO')
when response_type = 'TEXTFIELD' then apex_item.text(35,response_desc)
when response_type = 'TEXTAREA' then apex_item.textarea(35,response_desc,5,40)
when response_type = 'DATEPICKER' then APEX_ITEM.DATE_POPUP2(35,to_date(response_desc,'dd-mon-yyyy'),'dd-mon-yyyy')
end RESPONSE_DESC
from V_CASE_QUEST_LINK
where question_set_code like 'COB_Q%'
and case_mgmt_base_id = :P37_CASE_MGMT_BASE_ID
My problem is now grouping the questions by question_set_code. Because GROUP BY is evaluated after the select, it cannot simply be tacked on to the end of the query. I'm not sure that using a nested select will work here because of the apex.item calls. Anyone have a suggestion on how I can group these questions by the column?