1

The Tabular form was created on a classic report with an SQL Query (updateable report). It also has a wizard generated MRU & MRD process And the region source has the following code (written below) which works fine and displays columns as stated below

select 
"ROWID",
"EVAL_SR_NO",
(SELECT SKILL_DESC FROM TB_RCMI_EVAL_SKILLS 
   WHERE SKILL_ID ="TB_RCMI_CNDT_INTV_EVAL"."EVAL_SKILL_ID" ) as
"EVAL_SKILL_ID",
"EVAL_SKILL_REMARKS"
from "#OWNER#"."TB_RCMI_CNDT_INTV_EVAL"
where eval_type='TE'and WF_ID = :P33_WF_ID

UNION ALL

select 
"ROWID",
"EVAL_SR_NO",
(SELECT SKILL_DESC FROM TB_RCMI_EVAL_SKILLS
   WHERE SKILL_ID ="TB_RCMI_CNDT_INTV_EVAL"."EVAL_SKILL_ID" ) as
"EVAL_SKILL_ID",
"EVAL_SKILL_REMARKS"
from "#OWNER#"."TB_RCMI_CNDT_INTV_EVAL"
where eval_type='GE'and WF_ID = :P33_WF_ID
order by EVAL_SR_NO

A representation of my Tabular Form having 3 columns (i.e Sr No & Skill is of display only format and Remarks column is of text area) is depicted below:

Sr No Skill Remarks

1 Java Language
2 Oracle Database 3 Oracle DBA
4 Oracle Pl Sql
5 Communication
6 Analytical Thinking 7 Logical Thinking 8 Attitude
9 Leadership Qualities
10 Business Understanding

i need to add a dummy row (which will act as display only) between Sr No 5 & Sr No 6 as "General Evaluation". As shown below...

Sr No Skill Remarks

1 Java Language
2 Oracle Database 3 Oracle DBA
4 Oracle Pl Sql
5 Communication

"General Evaluation"

6 Analytical Thinking

7 Logical Thinking

8 Attitude

9 Leadership Qualities

10 Business Understanding

It would be of great help if any of you could help me out with this (with an detailed answer)

i hope this information would be help full... please let me know if i need to give in more information

awaiting feedback.Thanks in advance

('m using ApEX 4.1)

Udo Held
  • 12,314
  • 11
  • 67
  • 93
Janani
  • 13
  • 3

1 Answers1

0

What you really seem to need is 2 tabular forms on one page, which unfortunately isn't possible (yet?). How to solve this then? Unless you really absolutely need to have this editing functionality on one page: i wouldn't. If you do (and i mean absolutely must), then there is going to be fiddling involved with javascript. My advice: make 2 reports, provide an edit link. This is standard functionality too. Sure, no multiple edits at once, but this'll be easiest to maintain afterwards. Anything custom will have you ponder again afterwards, so it's worth considering.

If you do really need it, i think this is the most comfortable way to go about it: NO fiddling in the sql, except maybe a column more. No screwing around with unions with duals and ordering by some "pseudo" columns (because you need some way to make sure the dual column(s) are between certain values...).

Example with the EMP table

Region source:

select 
"ROWID",
"EMPNO",
"ENAME",
"JOB",
"DEPTNO"
from "EMP"
where "DEPTNO" IN (10, 20)
order by "DEPTNO"

DEPTNO is a hidden item. The order by is very important, since further processing depends on a certain ordering of the rows. Turn off column header sorting (checkbox for sort for columns on the report attributes).

Javascript:

function bind_for_changes(){
   //since emp is sorted by deptno, i can loop over the elements in this way
   //i also have deptno as a hidden item in the report, so that i can check its value
   //since this hidden item is the 4th editable item, its id will be f04_####
   //be sure to check the source output if you want to be sure.
   //for each input item with name f04 (deptno), do:
   //check if its value differs from our stored value.
   // if it does, but our var is still -1, then it is only the first record. Do nothing.
   // if it does and the var is not -1, then there is a difference between deptnos. 
   // for example, 10 -> 20. 
   // this change will be detected on the first row of deptno=20. So the splitter row
   // needs to be before this one.
   // The input item sits in a TD, the TD in a TR. We need to add a TR element BEFORE
   // the current one, so we get the TR and add a new one before it, with a TD in it.
   // note the colspan=3, which is the amount of displayed columns. If not sure, check the DOM.
   // Or, provide 3 TDs
   var deptno = -1;
   $("input[name='f04']").each(function(){
      if(deptno != $(this).val()){
         if(deptno == -1){
            deptno = $(this).val(); //first time, first record
            //dont change anything
         } else {
            //a change between deptno's. Add a row after the current one
            deptno = $(this).val();
            var tr = $(this).parent().parent();
            var newtr = $("<tr class='highlight-row'><td colspan=3 class='data'>In between rows!</td></tr>");
            tr.before(newtr);
         };
      };
   });
};

Do note, like i state in the js comment: you need to be aware of what the page will generate/be able to read the source/know DOM. More or less editable columns can and will screw your code up!

For example, on my page when you view source, what matters is the structure of the row in the report:

<tr class="highlight-row">
   <td headers="EMPNO" class="data">7782</td>
   <td headers="ENAME" class="data">
      <label for="f02_0003" class="hideMeButHearMe">Ename</label>
      <input type="text" name="f02" size="12" maxlength="2000" value="CLARK"  id="f02_0003" />
   </td>
   <td headers="JOB" class="data">
      <label for="f03_0003" class="hideMeButHearMe">Job</label>
      <input type="text" name="f03" size="9" maxlength="2000" value="MANAGER"  id="f03_0003" />
      <input type="hidden" name="f01" value=""  id="f01_0003" />
      <input type="hidden" name="f04" value="10"  id="f04_0003" />
      <input type="hidden" id="fcs_0003" name="fcs" value="3C09CABCBA62BE1A064146D162012CEF">
      <input type="hidden" id="frowid_0003" name="frowid" value="AAuDjIABFAAAACTAAC" />
      <input type="hidden" id="fcud_0003" name="fcud" value="U" />
   </td>
</tr>

Take note of the IDs and names of the inputs, and also where they're placed.

Also, since apex 4.1 (i believe), there is a mapping after the table element

<input type="hidden" name="fmap" value="CHECK$01" id="fmap_001" />
<input type="hidden" name="fhdr" value="Select Row" id="fhdr_001" />
<input type="hidden" name="fmap" value="ENAME" id="fmap_002" />
<input type="hidden" name="fhdr" value="Ename" id="fhdr_002" />
<input type="hidden" name="fmap" value="JOB" id="fmap_003" />
<input type="hidden" name="fhdr" value="Job" id="fhdr_003" />
<input type="hidden" name="fmap" value="DEPTNO" id="fmap_004" />
<input type="hidden" name="fhdr" value="Deptno" id="fhdr_004" />

This can be translated from the column attributes. But always be carefull and doublecheck. It never hurts and you still need to know the output code. column attributes

However, if all of this sounds too advanced/difficult, then don't go through with it! You'll only come to regret it afterwards. Rather use standard functionality for something like this: 2 normal reports with an edit link to a single record form page! But if you must, in my opinion, this is the cleanest path. You just need to know what you're doing.

Tom
  • 6,988
  • 1
  • 26
  • 40
  • Yes 2 tabular forms on one page is not possible so the only way was to create them manually (which again is a cumbersome)Thankyou so much.. will try incorporating the standard functionality unless my idea is not an absolute necessary.. – Janani Dec 15 '11 at 05:36
  • np - and if the answer helped you, accept it and earn yourself (and me) some rep ;) – Tom Dec 15 '11 at 08:10