Discussions
Categories
- 197.1K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.7K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 555 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.3K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 109 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 466 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
How to get Text Item Custom Attributes

hszero
Member Posts: 52
Hello all,
I am running a report creation like the select below...
SELECT apex_item.text (1,
printer,
20,
2000,
'rownum=' || '"' || ROWNUM || '"'
) AS printer
FROM DUAL
with no issues.
But I have questions on how to retreive the rownum attribute I have created?
I guess for that matter any custom attribute I choose to add, as there will be others.
I would like to be able to get those custom attributes in a for loop as shown below.
Any Ideas?
FOR i in 1..APEX_APPLICATION.G_F01.count
LOOP
?APEX_APPLICATION.G_F01(i).rownum?
END LOOP;
I am running a report creation like the select below...
SELECT apex_item.text (1,
printer,
20,
2000,
'rownum=' || '"' || ROWNUM || '"'
) AS printer
FROM DUAL
with no issues.
But I have questions on how to retreive the rownum attribute I have created?
I guess for that matter any custom attribute I choose to add, as there will be others.
I would like to be able to get those custom attributes in a for loop as shown below.
Any Ideas?
FOR i in 1..APEX_APPLICATION.G_F01.count
LOOP
?APEX_APPLICATION.G_F01(i).rownum?
END LOOP;
Tagged:
Answers
-
I don't think it's possible to access custom HTML attributes from PL/SQL code, at least not in a way that is out-of-the-box APEX. But you could use additional hidden columns to store additional values for each row. For example:
select apex_item.text(1, printer, 20, 2000) || apex_item.hidden(2, rownum) as printer from dual
Which would then be accessed as normal...APEX_APPLICATION.G_F02(i)
Any good?
Anthony.
--------------------------------------------------------------
http://anthonyrayner.blogspot.com -
Thanks Anthony,
I also expected to have issues with getting custom attributes but thought it was worth asking as I couldn't come up with anything else at the time. But as similar with many problems, time heals.
Here is the fix I put in place, and am posting as I am sure this is valuable to additional apex users.
The problem I had was that I needed to update only the rows that were denoted by the checkbox. But what made this more difficult was that the update has to get not only data from the report items but also from data the user entered in a text field. So what I ran into while looping was, apex_application.g_f01.count had a counter of only appx. 2, or what ever else the user checked. But in reality the info I had to get from the form was on record say 7 and 9. So in short, the indexes are different from checkboxes to textfields. To get around the following code worked... hope I didn't take the hard way to solve this problem...
--report definition
SELECT apex_item.text (1, xrt.printer) AS printer,
apex_item.checkbox (2, xrt.report_id) AS PRINT,
apex_item.hidden (3, xrt.report_id) AS hidden
FROM dual
--update script
FOR j in 1..APEX_APPLICATION.G_F02.count
LOOP
FOR i in 1..APEX_APPLICATION.G_F01.count
LOOP
IF APEX_APPLICATION.G_F02(j)= APEX_APPLICATION.G_F03(i) THEN
UPDATE dual SET printer = APEX_APPLICATION.G_F01(i)
WHERE report_id = APEX_APPLICATION.G_F02(j);
END IF;
END LOOP;
END LOOP;
Not exactly intuitive, but I am sure others have hit this issue before.
Hope this helps,
Hayden
This discussion has been closed.