Oracle Apex- Enter a value and convert it to a link - oracle-apex

I have a Master Detial with 2 interactive grids.
I would like to be able to genrate a link based on user input....is that at all possible?
To give a simple example:
Lets say I have website like https://www.google.com/
I would like a user to enter anything...for example "Prague"
Once this is entered, I would like APEX to generate a URL from it to result in: https://www.google.com/Prague
Now I know that Google search does not work like that, but I need that sort of mechanism for our internal company app. Is this possible?
Ideally , once the grid is saved the link in the Interactive grid only said "Prague" but if I click it, it would direct me to https://www.google.com/Prague

This can be achieved using the "JavaScript Initialization Code" attribute of the column.
Example on the EMP sample table (*). Functionality is that when a user enters a value in the ENAME column, it is converted to a google search url.
Create an editable IG on table EMP
Set the type of column ENAME to "Text Field"
Set "Javascript Initialization Code" for column "ENAME" to
function(config) {
config.defaultGridColumnOptions = {
cellTemplate: '&ENAME.'
};
return config;
}
Notice that the column now is a link. A user will have to open in new window to get the actual link value, since clicking the column will active the edit mode.
(*) Sample dataset can be installed using SQL Workshop > UTILITIES > Sample Data Sets > EMP/DEPT

yes, you can let user enter the value and by creating a dynamic action(choose the when attribute as whatever suits you) you can take that value and on another column, use that column as &Columnvalue. for example and concatanate it by using to base url using ||

Related

Oracle APEX - how to read a cell from interactive grid

The same question once again but with (I hope) better explanation:
I created the most simple case:
An Interactive Grid IG with data source EMP ( table with 14 records contains Ename, Job, HireDate, Salary etc. etc.)
Text field P7_ENAME
After running it looks like below:
What I would like to do is to copy Ename from selected record of IG to P7_ENAME field .
I found several tutorials (text and video) how to do it. Most of them suggest to create dynamic action SelectionChange on IG and when TRUE add a JavaScript code something like below:
var v_ename;
model = this.data.model;
v_ename = model.getValue( this.data.selectedRecords[0], "Ename");
apex.item( "P7_ENAME" ).setValue (v_ename);
and the second step is to create another action: Refresh.
So finally I have a dynamic action with two steps : the first one is a Java script code and the second refresh function on my P7_ENAME field.
Sounds simple and it is simple to repeat/implement. A guy (I suppose) from India published a video on YouTube (https://www.youtube.com/watch?v=XuFz885Yndw) which I followed and in his case it works good. In my case it simple does not work - field P7ENAME is always empty, no errors appears. Any idea why ? Any hints, suggestion ?
thanks for any help
K.
The best way to debug and achieve what you are trying to do is as follows:
create the Dynamic action with the following setup:
-when -> selection change[interactive grid],
-selection type -> region, region -> your IG region,
-client side condition -> javascript expression: ```this.data.selectedRecords[0] != undefined```
First action of the true of the DA with the type: execute javascript code and fire on initialization is turned on, code: console.log(this.data.selectedRecords);
Run your page, and check the browser console. You should see an array of columns when you select a record from that IG as follows:
Find in that array, which sort number of the array contains the data that you want to use for the page item. Let's say I want the 3rd element which is "2694" then I should change my dynamic action's execute javascript code to:
var value = this.data.selectedRecords[0][2];
apex.item( "P7_ENAME" ).setValue (value);
The last thing I should do is add another true action (and the refresh action at the end) to the same dynamic action with type 'SET VALUE' and 'PLSQL EXPRESSION' as type, put :P7_ENAME in the expression, items to submit P7_ENAME and affected element: item / P7_ENAME as follows:

How to pass parameter to my POWERBI embedded report?

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:

APEX changing row colors in an IG

I am following an example I found on-line as since I found it on the internet I know it must be correct. I am trying to search for a specific value in an IG and when it is found the line/row is highlighted with red text, Below it the logic I followed and screen shots. Please let me know what I am missing. He is using an employee example and I using my car dealership example. Thank you !
"Here's another approach that works great:
For an IR with this query:
select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO,
OFFSITE
from EMP
Define for the column JOB the following Static ID: MANAGER_STATIC
Then create a DA After Refresh on Region where On True Execute the following javascript with Fire
on Page Load=ON:
this.affectedElements.find('td[headers="MANAGER_STATIC"]').each(function(i) {
var lThis = $(this);
if (lThis.text() == "MANAGER") {
lThis.parent().children().css({
"background-color": "#C0C0C0"
});
}
});
And every row that has the value of MANAGER will be highlighted and this will respect pagination.
That Example appears to be for an Interactive Report, but you appear to be using an Interactive Grid.
The easiest way to do this (without coding) is to run the report and use the Actions Button to define Highlighting. E.G.
Fill out form similar to this (Change column selection and value to your requirement):
Afterwards, using the Action Button again to Report->Save the report so it saves the report for All Users.

How can I pass a value from one page so that my "Row text contains" filter is enabled in Oracle APEX

Is there any way in Oracle APEX where we can pass a value from one page to other page, and in the other page it emulates the filter same as "Row text contains".
For eg:
Page A ---> clicks on a link to call Page B and Passes a value '12345' to this new page.
And then
Page B opens up with all the values where row text contains '12345'
I have created a hidden field 'P17812_EMPLOYEE_NUMBER' on page B.
When I click on a link on Page A, I set the value in this field.
Now, I created a dynamic action on "page load" on page B. Where i write the below code :
$("#apexir_SEARCH").val($v("P17812_EMPLOYEE_NUMBER"));
gReport.search("SEARCH");
But this also doesn't work.
Is there any way we can implement this scenario?
Thanks for your help.
You can use IR_ROWFILTER in URL as a parameter and in parameter values the value that you want to filter like:
?p=App:Page:Session:Request:Debug:ClearCache:IR_ROWFILTER:12345:PrinterFriendly
You can read more about APEX url in here https://docs.oracle.com/database/121/HTMDB/concept_url.htm#HTMDB03019
and about IR filter https://docs.oracle.com/database/apex-5.1/HTMDB/linking-to-interactive-reports.htm
Create a hidden page item on page B, have the link set value to the item when you click on it
then have the same select statement from page A on B with a where clause
SELECT a, b, c
FROM test
...
WHERE b = %ITEM%
(THE % tells him that it can be whatever text or no text there)
and dont forget to pass the item to the sql query
I hope I understood what you want, and that my answer is understandable.

How to write a query based on the Date item, in interactive grid

I have a date field and a interactive grid. I am trying to generate the Interactive grid based on the value inputted in the date field.
I am trying to write the query as below :
select pap.effective_start_date , pap.effective_end_date
from per_all_people_f pap
where :SELECT_DATE between pap.effective_start_date and
pap.effective_end_date
Here, SELECT_DATE is the name of the Date field (datatype Date picker). I am writing a dynamic action on Change of Date field, and refreshing the interactive grid region.
But when I change the value in Date field, it doesn't return any rows.
I have done a similar change where my interactive grid was based on a dropdown. There I had to set the "page action on selection" to Submit, and it worked. But here, since it is a Date field, the "Page Action on selection" property doesn't appear on the page .
Can somebody please suggest, how can I achieve this.
You need to explicitly convert your bind variables, which are treated as strings, to dates.
to_date(:SELECT_DATE)
The format mask will come from the application properties, or you can be explicit with that, too.