I have Interactive report in apex application where first column USER_GID includes links or is a link column.
How do i change the color of the link?
Here column USER_ID contains links.
So 23, is a link and i want to change its color to blue.
So the links are distinguished.
How can i do that?
Apex 20.2
As I don't have your table, I used Scott's EMP. The idea is: if DEPTNO column represents a link (I used the one to Google), paint it differently for each department number.
Interactive report's query would then look like
select
'<a href="https://www.google.com" style="color:' ||
case when deptno = 10 then 'red'
when deptno = 20 then 'green'
else 'pink'
end ||
'">' || deptno || '</a>' detpno,
--
empno, ename, job
from emp
order by ename
Don't forget to set deptno column's "Escape special characters" property to "No".
The result is then
Related
Good day,
I am running orcl apex 20.2. I have a tree region with a simple table: id, title, parent_id.
I am struggling with the JS to get the selected node id, and store it in a page item. My JS skills are very week. I have been trying to use a dynamic Action to execute JS and use a treeNodeAdapter, but the object returned is a jQuery object. I have no idea what to do at that point.
Given the table above, can someone please write back the exact JS I would need in the DA to capture the selected id and save it to the page item...
Pls & thnx
Nikita
Here's how (based on Scott's EMP table).
Suppose it is page 70 which contains the tree region. Create a page item on it (for example, P70_EMPNO).
The tree query looks like this (pay attention to the link column; once clicked, it stores the selected node value into the P70_EMPNO page item):
select
case when connect_by_isleaf = 1 then 0 when level = 1 then 1 else -1 end as status,
level,
ename || ' (' || empno ||')' as title,
'icon-tree-folder' as icon,
empno as value,
ename as tooltip,
--
'javascript:$s(''P70_EMPNO'', '''||EMPNO||''')' as link --> this
from emp
start with mgr is null
connect by prior empno = mgr
order siblings by ename;
The result (when you click on the JAMES node):
P.S. It looks that your keyboard is broken; quite a few letters are missing.
I have a classic report where the rows are displayed in form of cards. I need to mark one card as selected whenever the report is loaded, perhaps by changing background color of that card.
The report is based on one SQL query and selected card should be based on querying another table. If a different card is selected I want the database to be updated to that selection.
How can this be done? I'd appreciate any pointers in the right direction.
I gave the region a static id but do not see how I can access individual rows - cards in this case
Presumably you are using the Universal Theme's "Cards" report template. That can handle highlighting via icons or colors. I have set up an example based on the EMP table here on apex.oracle.com (login as demo/demo).
My query:
select
ename card_title,
ename card_subtitle,
job card_text,
hiredate card_subtext,
'' card_modifiers,
apex_page.get_url(p_items=>'P6_EMPNO',p_values=>empno) card_link,
case when empno = :P6_EMPNO then 'u-color-39' else 'u-color-29' end card_color,
case when empno = :P6_EMPNO then 'fa-check' end card_icon,
'' card_initials
from emp
I have a hidden page item called P6_EMPNO, and when the user clicks on one of the cards that gets set by this link:
apex_page.get_url(p_items=>'P6_EMPNO',p_values=>empno) card_link,
Then that is used to specify an icon and different color for the card via these:
case when empno = :P6_EMPNO then 'u-color-39' else 'u-color-29' end card_color,
case when empno = :P6_EMPNO then 'fa-check' end card_icon,
You can find out all about Universal Theme cards, colors etc. at https://apex.oracle.com/ut/
i need a solution for this "conventionally" mean using apex native functionality.
I have two cascading check boxes when i select any or multiple value from the parent checkbox then the referenced values in checkbox 2 should return (this is working) but when deselect all the values from parent checkbox it should return all the value in checkbox 2.
https://apex.oracle.com/pls/apex/f?p=119345:15
help will be appreciated.
Try to use NVL in your input item.
SELECT DEPTNO || '-' || ENAME, EMPNO
FROM EMP
WHERE DEPTNO IN
(SELECT COLUMN_VALUE
FROM TABLE(APEX_STRING.SPLIT(NVL(:P15_CB1,DEPTNO),':')))
ORDER BY 1
Ex. https://apex.oracle.com/pls/apex/f?p=145797:3
login on: https://apex.oracle.com/pls/apex/f?p=4550:1
workspace: stackquestions
user: test
pwd: test
app: 145797
page: 3
APEX 4.2. I have Select List on form, based on query:
SELECT empno || ' ' || ename AS d, empno AS r
FROM emp
When select list expanded there two concatenated fields displayed.
But when some value selected and list collapsed I need only Ename displayed on form. So I need only JONES on pic 2 without number. Of course, return value must be empno anyway.
[EDIT] I mean I need both Empno and Ename displayed when Select List opened, only Ename displayed when it collapsed and always Empno returned.
Try adding another textfield to catch the name and place it over the select list.so every time you select an item, the value displayed is controlled in a separate container. You can try it by doing this:
Aside from the SELECT LIST ITEM you have created. Add another TEXTFIELD.
Then on the Main Page under Javascript > Execute when Page Loads
Paste this code:
$('#P5_SELECT_CONTAINER div:nth-child(2)' ).append($('#P5_TEXT'));
var s_width = Number($('#P5_SELECT').css("width").replace("px",""));
$('#P5_TEXT').css({"width":(s_width-22)+"px","position":"relative","right":s_width+"px","pointer-events":"none"});
But first youll be needing the name/id of your select list and the textfield you created. For this code,
select list id = P5_SELECT
textfield id = P5_TEXT
Just replace them(selectlist and textfield id) with what you already have.
Then create a dynamic action
EVENT = Change
SELECTION TYPE = ITEM
ITEM = P5_SELECT (or in your case Name of your SELECT LIST)
ACTION = EXECUTE JAVASCRIPT
then paste this code
var sel = $('#P5_SELECT option:selected').text();
var substr_sel = sel.substr(sel.indexOf('-')+1).trim();
$s('P5_TEXT', substr_sel);
console.log($v('P5_TEXT')); -- just to check if return is correct.
NOTE:just play with the width so that only the up/down arrow of the select list is displayed.
Hope this Helps
I have a small doubt. I have below query
SELECT empno
|| '|'
|| ename
|| '|'
|| sal
|| '|'
|| comm
FROM (SELECT empno,
ename,
sal,
comm
FROM emp);
the output is coming as :
7611|Grp Fract|2001|.11
7499|ALLEN WOR|1600|.22
7521|WARD|1250|10.23
7566|JONES|2975|234.23
7654|MARTIN|1250|.98
the last column COMM has value as 0.11, 0.22, 0.98
but the above query returns data as .11,.22,.98. Can anyone help me understanding why it is happening when I am concatenating the data and how to resolve this , I need exact value as it is in COMM column.
The o/p should be as
7611|Grp Fract|2001|0.11
7499|ALLEN WOR|1600|0.22
7521|WARD|1250|10.23
7566|JONES|2975|234.23
7654|MARTIN|1250|0.98
Ths comm column is defined as number(7,2).
Thanks
Use the TO_CHAR function with a proper format model. It seems you want LTRIM(TO_CHAR(comm,'999990.99')) here.
The LTRIM(TO_CHAR(comm,'999990.99')) works for values which have 2 digits after decimal point.
If value like 0.123523 is used above it rounds off the decimal places keeping 2 digits only.