APEX Column value to change based on LOV in IG - oracle-apex

Screenshot of my settings. On Interactive Grid - I have column-a "TaskID" and other column-b is "Predecessors", which is LOV of “TaskID” column. Each TaskID has a start date in Column-C. When I change the column-b value, the column-C date should change. I mean it should look for the TaskID column and return the corresponding date.
Any suggestions would be greatly appreciated. May be a dynamic action or SQL query.. I don’t know
Column a (TaskID), Column b (Predecessors), Column c (StartDate)

Yes, using a dynamic action will be the easiest way to do this.
Create an on change dynamic action on your predecessors column:
Then create a Set Value Action using the corresponding SQL query:

Related

Oracle Apex 22.21 - Chart Page - Bar Type - How to return a range of date values based on user input

I have a table ORDERS which contains column ORDER_DATE. I have created a Chart as a Bar type.
Right now, the chart returns all the orders because I did not specify a Maximum Rows. The date on the x-axis and the number of orders on the y-axis.
How can I add a form for the user to select a range of dates and return only the values for those dates?
Example:
Doesn't necessarily have to be a calendar. A dropdown is fine as well. Or even a 'text' input since that is the easiest way.. I just need to know how to go about creating this feature. Your help is appreciated. Thank you.
First create a page item as date picker or some other plugin you already have to let users select a date or date range. (make sure that when user selects a date, the page item value is set by using a dynamic action or by a setting that your plugin has (set item value after selection kind of setting) )
Then create a new view with the source of your ORDERS table but it should have a where statement as it filters records by your page item such as:
select count(1)
from ORDERS
where order_date between :P1_DATE_FROM and :P1_DATE_TO
Set the source of the chart to this new view.
After user sets a value, refresh the chart by a dynamic action if it is not refreshed automatically.
In summary, the idea is to make your chart's source filtered by page items that users can change. Then refreshing the chart so that the new page item values are effective.

Is there any way to get the displayed text in the "Select List" without using SQL? (Oracle APEX 21.1)

Anyone help me?
"Select List" (name: P2_SHOPS_LIST) that is created with the following SQL
SQL Statement: SELECT SHOP_NAME, GROUP_ID FROM T_ENTRY_SHOPS WHERE ID=:P2_LOV_ID;
It is necessary "GROUP_ID" because it is PK . But I need edit "SHOP_NAME" value and display to Text Field.
I think I can get the currently displayed SHOP_NAME by combining the above SQL with the selection row number, but is there any way to access this value with No SQL? Like
:P2_SHOPS_LIST.SHOP_NAME
(This gave me an error XD).
In the context of JavaScript, you can use the following
$('#P2_SHOPS_LIST option:selected').text()
This can be passed through to PL/SQL via a dynamic action, such as on change of your select list.
Or you could set your text item on change via a JS based action, using 'Set Value' and that code as the expression.

How to add the dynamic pivot table columns in apex interactive grid?

Is it possible to add dynamic pivot columns in the APEX interactive grid query?
PL/SQL function body returning SQL query:
DECLARE
l_piv_col VARCHAR2(1000) := NVL(:P1_DEP_PIVOT,'10 DEP1');
l_statement VARCHAR2(4000):=
q'~
select rownum row_num,JOB,MGR,DEP1,DEP2,DEP3
from
(select JOB,
MGR,
SAL,
DEPTNO
from EMP
)
src
--PIVOT (sum(sal) for deptno IN (10 DEP1,20 DEP2,null DEP3)) Piv
PIVOT (sum(sal) for deptno IN (##PIV_COL##)) Piv
~';
BEGIN
RETURN REPLACE(l_statement,'##PIV_COL##',l_piv_col);
--RETURN l_statement;
END;
P1_DEP_PIVOT -> (10 DEP1, 20 DEP2, null DEP3)
In the pivot deptno in, I need to use the dynamic columns.
sum(sal) for deptno IN (##PIV_COL##)
I am not sure, how to add the dynamic pivot columns in APEX Interactive grid?
Any help is greatly appreciated.
Thanks
Thanks for the reproducible case.
Classic Report is the only APEX Component which supports the query returning a changing set of result columns. Interactive Reports and Interactive Grid do not support this.
In classic report, pick the region source as PL/SQL function body returning SQL query and enable the Generic Columns switch. Then configure the maximum amount of columns, and you're good to go.
There are a couple of workarounds that I can think of if you really need an interactive grid (IG).
Store the results of the query in a collection, create an IG on top of the collection and have a server side condition to hide the columns that should not be displayed
Make sure your query always returns a fixed number of columns and have page item (to manage hide/show) for each of the columns. If a column should not be in the pivot, hide it based on the page item.

How to add a new column with custom values, based on a WHERE clause from another table in PowerBi?

I am stuck while dynamically forming a new column based certain WHERE clause from another Table in PowerBi. To give more details, let's say I have a table with item numbers associated with a Customer Name. In another table, I have to add a new column, which will dynamically add the item numbers associated with a particular customer and append as a query parameter to a base url.
So, my first table looks like this:
The second table that I want is this:
The query parameter value in the URL, has to be dynamically based on a SELECT query with a WHERE clause and pick up the ItemNumbers using the Customer field which is common between both. So, how can this be done in PowerBi? Any help would be really appreciated :)
I have one table in my model "TableRol" if I want to summarize my Date as the string I can use CONCATENATEX;
URL = CONCATENATE(CONCATENATE("http:\\mysite.com\parametersHere\getitem?='",CONCATENATEX(VALUES('TableRol'[Date]), 'TableRol'[Date],";")),"'")

Refresh Apex 5.0 chart results with different dynamic actions on same SQL query

I have created a bar chart on APEX 5.0 where my query looks like below:
select col1 as label,col2 as value from table1 where :P3_NEW_1 = col3;
here: P3_NEW_1 the page item I have created of type "Select List".
The list of values in "Select List" page item are pre-populated in the dropdown using the "Shared component" type I have created and so far this worked fine and I am able to display the results of above query by passing the value through the page item select list.
Now I need to add 2 data pickers on the same Apex page such that I should now be able to filter the results using date picker through dynamic action.
I know that using an additional button I can create a dynamic action but my problem is how do I modify the above query such that following should happen.
During the page load, once I select a particular value from the "Select List", it should display records based on the value selected from dropdown
This I already achieved using above sql query for the bar chart.
Once the bar char is displayed, I should next be able to filter and display the results using date ranges through date pickers.
Here my problem is my bar chart query is same but I need to now pass the start_date and end_date to the same above sql query which but I am not sure how to achieve this. If I add a button for dynamic action I need to select the report region which is the "bar chart" region and here my query needs modification.
Once the bar chart display the results, at the next step how do I filter the results by having the date filters with dynamic action on the same region where bar chart was displayed. How to achieve this?
You can change the query to something like this:
SELECT COL1 AS LABEL,
COL2 AS VALUE
FROM TABLE1
WHERE :P3_NEW_1 = COL3
AND (:P3_START_DATE IS NULL
OR TO_DATE(TIME_STAMP,'YYYY-MM-DD-HH24:MI:SS') BETWEEN :P3_START_DATE AND NVL(:P3_END_DATE,SYSDATE));
Where :P3_Start_date and :P3_End_date are the Start and End date pickers and TIME_STAMP is your column where you store the date.
After modifying the query you can simply add a button where at Behavior>Action select Submit Page.
This way when you click the button, the page will be submitted and chart refreshed.
If you want to take your chart to the next level you can do a partial refresh on it. Here is a short video tutorial of partial refresh on a report but you can apply the same login on your chart.