How do i can create IR in apex oracle based on different table and column - oracle-apex

IR based on PL/SQL Function Body returning SQL Query.
How do i can create Interactive reports based on multiple table and Deferent column name.
Exp :-
Select list item return three value
1 or 2 or 3
And the function return query basen on select list value
when Value equal 1
Select name, satate, country_id from cities
when value equal 2 Return
Select country, id from country
when value equal 3 Return
Select ocean,oc_id,from oceans
The three query return different column name and value.

Ok firstly, your question is poorly written. But from what I gather, you want an SQL query that returns different things based on an input.
I dont think you even need a plsql function body for this.
Simply do something like this:
SELECT * FROM
(SELECT name as name,
state as state,
country_id as id,
1 as value
FROM cities
UNION ALL
SELECT country as name,
NULL as state,
id as id,
2 as value
FROM country
UNION ALL
SELECT ocean as name,
NULL as state,
oc_id as id,
3 as value
FROM oceans)
WHERE value = :input_parameter_value;
Because if you are trying to display a variable number of columns and constantly changing their names and such. You are gonna have a bad time, it can be done, as can everything. But afaik its not exactly simple

No objections to what #TineO has said in their answer, I'd probably do it that way.
Though, yet another option: if your Apex version allows it, you can create three Interactive Report regions on the same page, each selecting values from its own table, keeping its own column labels.
Then create a server condition for each region; its type would be Function that returns a Boolean and look like
return :P1_LIST_ITEM = 1;
for the 1st region; = 2 for the 2nd and = 3 for the 3rd.
When you run the page, nothing would be displayed as P1_LIST_ITEM has no value. Once you set it, one of conditions would be met and appropriate region would be displayed.

Related

Remove value from popup lov once its selected

I'm trying to create lov in which once the machine is started it should not show in popup lov after submit.
Popup lov sql is as below:
select machineid,machinenm from machinemaster where idlemachine = 'Y';
but the issue is once machine is status change and this query not finding result for the perticular machineid so in lov it shows blank.
Please suggest any workaroud.
First of all, query you posted looks wrong. Generally speaking, list of values' query returns two values in the following order:
display value
return value
We usually display names and return IDs, which means that you'd probably want to use
select machinenm as display_value,
machineid as return_value
from machinemaster
where idlemachine = 'Y';
the issue is once machine is status change ...
How is that statement reflected in query you posted? There's no "status" column nor "change" status itself; where clause says where idlemachine = 'Y' - no status, no "change".
... and this query not finding result for the perticular machineid so in lov it shows blank
I believe that you should set the Display extra values property ON. Help says:
An item may have a session state value which does not occur in the given list of values definition. Select whether this list of values displays this extra session state value. If you choose to not display this extra session state value and there is no matching value in the list of values definition, the first value in the list of values is the selected and displayed value.
If you're seeing the NULL value, it means that you actually set
display extra values to OFF
display null value to ON

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],";")),"'")

Calculated column based on What-if parameter

I have a table visual in PowerBI that summarizes work hours by employee. The first column shows the employee name.
When training managers on how to use it I want to anonymize by showing employee numbers instead of names.
I tried adding a what-if parameter Anonymous with values 0 and 1 and use IF() in the DAX of a calculated column but it is not working. It ignores the parameter value.
Person = IF(Anonym[Anonym value] = 0; Time[Name]; Time[Empno])
will always show Name.
Person = IF(Anonym[Anonym value] = 1; Time[Name]; Time[Empno])
will always show Empno.
Another option if you really need to use a column and needs it to be "dynamic" is to use a PowerQuery parameter and add a new column based on it and then create your conditional. The downside of this is that you will have to refresh your query everytime you want to change the parameter

How can I ouput the values of a column (values() function) as a list in DAX for Power BI?

I use Power BI to create reports and visuals for large enterprise clients.
I have an interesting request from one of my clients: they would like to be able to see a summary of all filters that are applied to a given report. I used the ISFILTERED() function to create a card visual that lists the dimensions that are filtered, but they would like to be able to see which values are being shown. This works just fine when they have sliced or filtered for just one value, but how can I show when more than one is selected? My DAX is below:
Applied Filters =
var myvalues = VALUES(mytable[dimension_column])
return
IF(ISFILTERED(mytable[dimension_column]) = FALSE(),
"Not filtered",
"Column Name:" & UNICHAR(10) & mylist)
When only one value is selected in the slicer, the output is:
Column Name:
Selected Value
Obviously, when more than one value is selected in the slicer, variable mylist will have more than one value and the function fails. My question is, how can I convert the column myvalue to a list in DAX, so I can output each and every value?
What I want to get is:
Column Name:
Selected Value1,
Selected Value2,
etc.
Thank you!
One possibility is to concatenate all the values into a single string.
For example, you'd replace mylist with the string
CONCATENATEX(VALUES(mytable[dimension_column]), mytable[dimension_column], UNICHAR(10))
You're really only returning a single value for the measure, but it looks like a column.
Another approach is, instead of using a card, to simply create a table visual that just has mytable[dimension_column] for the values. This table will automatically filter as you adust slicers.

APEX SELECT LIST unwanted value

I have a select list that insists on display an numeric extra value, based on an id. I didn't get this issue with another select lists.
The basic query is
select description,id
from situation
where ID = 2 and user_id = 1
UNION
select description,id
from situation
where ID = 3 OR ID = 4 and user_id = 5
The select list get an numeric value that represents the previous id from the query. I have tried with a simple query but doesn't work.
When i try it on sql command, works fine.
Anyone could help me?