Populating apex item checkbox in report row based on database value

Hi All
I am looking for help setting an apex item checkbox to 'checked' depending on a record exisiting in a database and I would appreciate a little guidance.
At the moment I have a report which looks a bit like this
SELECT licence_user_identifier,
description,
licence_name,
apex_item.checkbox(22,licence_id)
FROM TABLE(SOL_LICENCE.F_RETRIEVE_ORG_LICENCES ( 121 ));
4 columns and the last column is a checkbox called 'assign' and is used to assign the selected licence to a user(who is already displayed on the page in another table). There is save button which when clicked saves a record to the database if the checkbox is selected.
However when the page is displayed the checkbox should be prepopulated/checked if there is a record in the database saying that the licence is assigned to the current user. I have created a page process to try and collect this information and populate the checkboxes on load - before header. However I am having difficulty referencing the apex_application item the corresponds to each row because when I use the FOR i IN 1 .. apex_application.g_f22.COUNT LOOP it only selects the item if it is checked. Can anyone point me in the right direction?
here is the process I have to populate the checkboxes, it is not getting to my flow.debug as there are no selected checkboxes:-(
DECLARE
v_count     NUMBER;
CURSOR getlicences (p_co_id so05.co_id%TYPE)
     IS
SELECT     licence_id
FROM     so05_cust_org_licences
WHERE     co_id = p_co_id;
BEGIN
     IF :p9_co_id IS NOT NULL
     THEN
          FOR each_rec IN getlicences (:p9_co_id)
          LOOP
               --check if a record exists
               SELECT     COUNT ( * )
               INTO     v_count
               FROM     so05_cust_org_licences
               WHERE     co_id = :p9_co_id AND licence_id = each_rec.licence_id;
--if the record exists populate the checkbox
               IF v_count > 0
               THEN
                    FOR i IN 1 .. apex_application.g_f22.COUNT
                    LOOP
wwv_flow.debug ('bbbbbbbbbbccccccccccandwearein' || v_count);
                         IF apex_application.g_f22 (i) = each_rec.licence_id
                         THEN
                              apex_application.g_f22 (i) := 1;
                         END IF;
                    END LOOP;
               END IF;
          END LOOP;
     END IF;
END;
Thanks in advance
Lynn

Hi,
Sorry my mistake. You can use the above link only to solve this problem, for this you have to use a hidden column to which you will assign 'Y' or 'N' as mentioned in that post.
using that hidden column value you can fire your query accordingly.
let's say your hidden column is f01 and checkbox column is f02 and the id column is f03, you can do like this
create a process before your update process like this
BEGIN
    -- Reset the hidden ADMIN_USER flag for all visible records to N
    -- Note: g_f01 maps to the hidden ADMIN_USER column
    FOR ii IN 1 .. APEX_Application.g_f01.COUNT
    LOOP
        APEX_Application.g_f01(ii) := 'N';
    END LOOP;
    -- Set the hidden ADMIN_USER flag for those records where the
    -- checkbox has been set by the user to Y
    -- Note: g_f02 is the checkbox column ADMIN_USER_CHECKBOX
    FOR ii IN 1 .. APEX_Application.g_f02.COUNT
    LOOP
        APEX_Application.g_f01(APEX_Application.g_f02(ii)) := 'Y';
    END LOOP;
END;then write a new process positioning after above process
if apex_application.g_f01 = 'Y' then
  your update query using id column (f03)
else
  your delete query using that id column (f03)
end if;hope this helps you.
Thanks
Tauceef

Similar Messages

  • Color report rows based on a value in that row

    I would like to Color report rows based on a value in that row.
    For examplle with the "EMP" table:
    I would like job=MANAGER to be red and job=CLERK to be green etc etc
    The other example I found only had the option of one color either the highlight or the default color.
    I am looking for a way to do multiple colors.

    Hi,
    In the row template, you can use #1#, #2#, etc to indicate where a field in the report needs to be output. This does not have to be plain text - ie, you can use it within style tags if you like.
    So, take a query like:
    SELECT EMPNO,
    ENAME,
    DEPTNO,
    DECODE(DEPTNO, 10, 'green', 20, 'red', 30, 'cyan', 'white') BG_COLOUR
    FROM EMPYou get columns 1=empno, 2=ename, 3=deptno and 4=bg_colour. In the row template, you can then do:
    Before Rows setting (sets up the table):
    <table>
    <tr><td>ID</td><td>Name</td><td>Dept</td></tr>After Rows setting (closes the table):
    </table>Row Template 1 (used for ALL rows):
    <tr style="background-color:#4#;"><td>#1#</td><td>#2#</td><td>#3#</td></tr>Then, for every row, the colour that has been calculated using the DECODE function will be used in the style tag to colour the background for the entire row.
    How you determine the colours is up to you. I've used DECODE here, but you could use a field on the DEPT table to hold this and use this in your SQL statement.
    Andy

  • Count the number of rows based on the values!!!

    Hi all,
    What I am using:
    I am working with a multidimensional database in Visual Studio 2010 using its Data source view and calculation member and dimension usage.
    What I want to do:
    I have a fact table that has five columns(leg(s),hand(s), Head and body,overall) that shows the category of how severe the injury is. Let say for the records all columns never have an empty value(no injury is stated with 'No injury' ) . These five columns
    are connected with a dimension that has all the available values (Category A-E of injury).The overall has the most severe from the other four columns. I want to create a bar chart with five different measure
    values, one for each column, and count the values in those columns. 
    For example : I have a slicer in the excel and a bar chart and the slicer has all the values of the Category of the injury ( Cat a,Cat B, Cat C, ... Cat E, No injury ) and when i select one of them, lets say
    Cat C,  the bar chart should update and show how many Cat C each measurement column has. 
    Example FACT table:
    ID      LEG      HAND    HEAD   BODY OVERALL
    1        No         A           No        No        A
    2        No        D            C          C         C
    3    E         C            D           A         A
    4         E          E           B            C         B
    So if i selected C the bar chart will count   (Leg = 0, Hand = 1, Head = 1, body = 2 and Overall = 1).
    Any ideas ?
    Thanks for the help and the time :) 

    Hi DBtheoN,
    According to your description, you want to create a chart on excel worksheet to count the rows based on the value, right? If in this case, I am afraid this issue is related to Office forum, I am not the expert of Office, you can post the issue on the corresponding
    forum.
    However, this requirement can be done easily on SQL Server Reporting Services. You can using the expression below to count the rows.
    =COUNT(IIF(Fields!LEG.Value=Parameters!TYPE.Value,1,NOTHING))
    Regards,
    Charlie Liao
    TechNet Community Support

  • Conditional Formatting for Report Rows based on page item

    Hi,
    I have a report and a page item on a page. I would like to somehow highlight any report rows where a particular column in the report (e.g. "Customer_ID") matches the page item (e.g. P2_CUSTOMER_ID).
    Any idea how to do this?
    Thanks,
    Forrest

    You can also achieve this by jquery ( Please note - I just started learning jquery , so my way of doing it may not be a good way of doing it)
    1. Download jquery from [http://www.jquery.com]
    2. In Page Header enter
      <script type="text/javascript" src="#WORKSPACE_IMAGES#jquery.js"></script>
       <script type="text/javascript">
       $(document).ready(function(){
          //t20data is the class for table cells in theme 20 .. change it as per you theme - right click view source and find it
             x = $('.t20data').length;
         //i=7 is the column index of customer id
        // i = i + 10 , 10 is the number of column
           for( i = 7 ; i < x ; i=i + 10)
                if($('.t20data').eq( i ).html() == $x('P2_CUSTOMER_ID').value)
                    // i-7 is the first cell of row and i+2 is the last cell of row 
                    for( c = i - 7 ; c <= i + 2 ; c++)
                         $('.t20data').eq( c ).css("background","red");  
    </script>[ E X A M P L E | http://apex.oracle.com/pls/otn/f?p=62171:1]
    Regards,
    Shijesh

  • Display interactive report rows based on user role.

    Hello,
    Can anyone please help me out with this issue. i have an interactive report and now i want to make this report as conditional based on user role. Like i want to dispaly all the report rows for an Admin user role and for a developer I want the report to display only his/her rows. Can anyone please help me how can I resolve this issue.
    Do I need to have two separate reports for each role or can we make achieve this with only one report.
    thanks,
    Orton

    Here is a possible answer.. Build your Interactive report off of a collection. And when you build the collection you can build an if statement to either build your select with or without the filtering of user_id..
    See this blog entry for how to build a interactive report from a collection: http://www.oracleapplicationexpress.com/tutorials/71-oracle-apex-interactive-report-based-on-plsql-function
    Thank you,
    Tony Miller
    Webster, TX

  • How can I select and delete rows based on the value in one column?

    I searched through the discussion board, and found a thread on deleting blank rows, but not sure how to modify it to work with my issue.
    I have put together a rather complicated spreadsheet for designing control systems, it calculates parts needed based on check boxes selected in a second spreadsheet.
    Since not all systems require all parts there are many rows that have a 0 quantity value, I would like to select these rows and delete them once I have gone through the design phase (checking off required features on a separate sheet).
    I like the way the other thread I found will gather all the blank rows at the bottom without changing the order of the rows with data in them.
    I don't understand exactly how the formula in the other thread works well enough to modify it to look for a certain column.
    I hope I made myself clear enough here, to recap, I would like to sort the rows based on a zero value in one (quantity) column, move them (the zero quantity rows) to the bottom of the sheet, and then delete the rows with a zero quantity (I can delete them manually, but would like to automate the sorting part).
    Thanks for any help anyone can provide here.
    Danny

    I apologize but, as far as I know, Numbers wasn't designed by Ian Flemming.
    There is no "this column will be auto-destructing after two minutes"
    You will have to use your fingers to delete it.
    I wish to add a last comment :
    if your boss has the bad habit to look over your shoulder, it's time to find an other one.
    As I am really pig headed, it's what I did. I became my own boss so nobody looked over my shoulder.
    Yvan KOENIG (VALLAURIS, France) mercredi 13 juillet 2011 20:30:25
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Combine rows based on column value

    I'm trying to combine rows based off of a common value.
    Table Data:
    Result A
    Player_ID   Player_Name  Team_Name  Points Sequence
    99999       John Smith    Bulls              50         1
    99999       John Smith    Pistons          14         2
    What i want in the output
    Result B
    Player_ID Player_Name Team_Name  Points
    99999     John Smith      Bulls           64 (50 for Bulls)Here's my main query...
    select player_id, player_name, team_name, points
    from
              SELECT player_id, player_name, team_name, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id, player_name, team_name
              ) t
    ORDER BY sum_points DESC, last_name;**The current query gives me the output from Result A
    1) Not entirely sure how to combine data based of player_id
    2) Once i figure out 1, im sure by adding the ('sum_points' for 'team_name') to the output can be done with a case statement, i think?

    Sorry about that Frank.
    Using: Oracle 10.2g
    i was incorrect about the output of the query
              SELECT player_id, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id
    )Output
    Player_ID      Sum_Points    
    99999              20        
    55455               6          
    66489               2  So the subquery is outputing the correct data
    The output of the original entire query(that you had posted) is:
    Player_ID    Player_Name   Team_Name    Points    
    99999        John Smith      Bulls               16 (8 for  Bulls)    
    55455        Bob Johnson    Rockets          6   (3 for Rockets)
    66489        Chris Terry       Kings              2   (1 Kings)Here's some more raw sample data from the table:
    Player_ID    Player_Name   Team_Name    Points     Sequence  Game_Type_ID Team_ID
    99999        John Smith      Bulls               12          1                       1                  5
    99999        John Smith      Bulls               0            1                      -1                  5
    99999        John Smith      Pistons            4           2                       1                 12
    99999        John Smith      Pistons            0           2                       -1                12
    55455        Bob Johnson    Rockets          4           1                        1                  3 
    55455        Bob Johnson    Rockets          0           1                       -1                  3 
    66489        Chris Terry       Kings              2           1                        1                  8
    66489        Chris Terry       Kings              0           1                       -1                  8So your code frank is very close, the issue is that:
    A) All players have a ('pt value' for 'team name') even if they played on the same team, which can prob. be solved with a case statement, which i tried to do in my last post.
    WITH       grouped_data     AS
              SELECT player_id, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id
    SELECT     g.player_id
    ,     s.player_name
    ,     s.team_name
    (case when sequence = 2 then g.sum_points  <==
         ||  '('
         ||  TO_CHAR (s.points)
         ||  ' for '
         ||  s.team_name
         || ')'
    else to_char (g.sum_points)
    END)     AS points
    FROM     grouped_data     g
    JOIN     stats_data     s     ON g.player_id     = s.player_id
    WHERE     s.sequence     in (1,2)     <==
    AND     s.season_id     = 2008
    AND     s.points     > 0;the output has two issues, for players who played on more than one team, like Josh Smith the output comes out as
    99999        John Smith      Pistons           20  (2 for Pistons)        
    99999        John Smith      Bulls               20While the players who played on one team came out correctly. So issue with my edit of your code is:
    A) josh smith is output 2, needs to be output once
    B)josh smith should say (Josh Smith Bulls 20 (4 for Pistons) not "99999 John Smith Pistons 20 (2 for Pistons)"
    c) Issues with "99999 John Smith Pistons 20 (2 for Pistons)" is that it listing the wrong team for him: should be Bulls and listing half of his total with the pistons in the prentices should be 4. --The reason that is because s.points needs to be summed as based off of the data there's two entries
    Hope this clears it up, thanks!
    Edited by: user652714 on Mar 11, 2009 9:28 AM

  • Changing fields based on database values

    Hi all,
    I have one form and two drop -down fields. The fields are Call Type and Sub Call Type and are on the SAME form. I pull data from the Call Type from the database. When the user selects a particular Call Type, I need to go back to the database and pull in values associated with that particular Call Type.
    This is the method, that I am using:-
    1) I first populate the Call Type drop down field by using a Server Side Method to fill in values for the Call Type and calling the database.
    2) I then call a method called as PopulateSubCallType by using the property On Change Invoke for the Call Type field.
    In this method I again call the database and based on the Call Type selected by the user, I pull in the associated Sub Call Types and store them in an array.
    3) I also call the same array to populate the Sub Call Types based on Call Types. But the drop down field for Sub Call Type is not auto-populated based on the values from the array. The array values although pulled up from the database are not shown on the form.
    Can you tell me a way to auto-populate the Sub Call Type from the database based on the Call Type selected by the user but on the SAME form.
    I AM NOT USING JSP's but ONLY ALBPM 6.0 PRESENTATIONS.

    refreshValidValues("someAttribute") is a method that comes with BPM Object presentations.
    This one line in this method will work because it causes the attribute (child in this case) to automatically invoke the method you created for retrieving the valid values of the children of the parent.
    Your server side method that dynamically returns valid values of the children based on the parent selected should be looking something like this:
    for each ...
    select * from child
    where parentOfChild = parentAttribute
    In this example the name of your parent attribute is "parentAttribute" column in the child database table that contains the parent's id is "parentOfChild".
    This causes the list of children to auto populate in the child combo dropdown automatically.
    To summarize - at runtime here is what happens:
    a) since the parent has a dynamic method that populates its valid values, as the presentation initializes the SQL for the valid values of the parent is run.
    b) the parent's combo dropdown is populated with a list of valid values of the parent
    c) the end user selects one of the parent's names from the combo dropdown
    d) this causes the method to fire that has only one line. This one line has the text "refreshValidValues("nameOfTheChildAttributeGoesHere")
    e) since the child has a dynamic method that populates its valid values, when the previous step caused this child attribute to refresh its valid values, the SQL in the method that dynamically retrieves the valid values of the child is run.
    f) the end user clicks the combo dropdown on the child's attribute and sees that the child valid values (based on the parent that was just selected) now appear.
    Dan

  • Trying to alter font on a report row based on data condition

    Hello.
    I have an Apex application with a "classic" SQL report and a corresponding form.
    In the report region I am pulling all items from a table (Select * from TASKS)
    The TASKS table contains many columns including DUE_DATE and COMPLETE_DATE field.
    I am trying to find a way to format the rows in my report based on the condition of those two fields.
    If the record has a complete_date (not null) then I want to change the font for the entire row (each column) to be grey.
    If the record does not have a complete_date (null) and due_date is before today, I want the row to be bold and red.
    Otherwise, the row would display standard black text.
    I can't seem to find a straightforward way to do this in Apex.

    Hi JodyMorin,
    Try looking at this post:
    Conditional item formatting (color)
    You will need to tweak the code a bit for your needs, but I hope it helps.
    -Marc

  • Is there a way to Assign Values in many rows based on search values in APEX.

    I used Region, Process by to search the report which appears as shown above. Then I use Choose Auditors column to select my Auditor and copy paste it into the report under To be Audited By col. Is there a way to automate the process. I am here using a tabular form in APEX. My main aim is to assign auditors based on Region, not equal to Processed by.
    Any support on this will highly be appreciated.

    There are company-internal resources for assistance with company-internal issues.
    There are MOS forums available through a MOS login, readability limited to anyone with a MOS login, so that one is quasi-public.
    ... then there are these public-readable forums-dot-oracle-dot-com that are for the generic user community -- readable to anyone in the world regardless whether logged in or not.
    I think you may need to take some time to get familiar with where you need to seek help for each individual occasion.
    In the mean time, I have arranged to have this thread locked.
    The text in it may help others in the future to pause for a moment before joining and posting.

  • Apex 3.1, Interactive Report Row Text Search, image bitmap as TEXT?

    I think this IR thing is powerful which could save me lots of time in development.
    One question: does the row text search(default: all columns) treat image column as regular text(string)? I did the following search on:
    SAMPLE APPLICATION-->Products, I put 300 in the search column( for $300 list-price search), the search produces 3 lines( should only have 2). the 3rd line's list price is $1999, I looked it in SQL*PLUS and saw its image bitmap (long string) includes a "300" inside, so I believe the "default all columns search" treat image as regular string.
    How can I avoid the image bitmap search included in IR? This bitmap strings are very long for each image and can EASILY match searching conditions for something like PRODOUCT DESCRIPTION, PRODUCT PRICE for our products data( about 25000)? thanks
    sean

    Sean / Russell,
    Thanks for reporting this, it's certainly a bug.
    By the way, the search is performed in SQL, on whatever column values are being displayed (run the page in debug mode to see the full SQL). So in the case of the sample application, it is not matching the image bitmap, but the image size, which is selected in the SQL. The bug is that the full search should not include columns which have filtering disabled or one of the special image format masks. We'll try to fix this for an upcoming patch.
    Thanks,
    Marco

  • Hidden apex item needed in report

    hello all,
    basically i'm having a design problem since some apex_item.hidden items must have the show attribute to true in order to use the id's they hold. so the report shows empty columns and that an issue.-
    can anybody give advice on hidding these columns and still use the column values?
    i'm adding a screen cap of the problem.
    http://i.imgur.com/JeOdp.jpg
    thanks in advance.

    i've been looking around and found something that is hard to believe, the workaround for my problem is:
    APEX_ITEM.HIDDEN(1,empno)||
    APEX_ITEM.TEXT(2,ename) ename,
    anyway it is not working (i got no data found).

  • How to change the chart color in report 6i based on its value?

    I built a simple chart using Chart Wizard in Report 6i, with X axis = supplier and Y axis = rating. I want the chart to show different color for certain rating, eg: above 80% => red color.
    Anyone know how to do this?
    Pls help!

    Hi Resham,
    In SP list, you change the background color of field value using Content editor and javascript.
    Add the content editor webpart on the list page with javascript which highlight the particualr value based on the condition.
    You can refer to following link
    http://blog.pathtosharepoint.com/2009/02/26/highlight-rows-in-sharepoint-lists/
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • Urgent - Report Column based on LOV - Value not found in LOV

    Hi All,
    Recently, we have upgraded to HTMLDB 2.0 from HTMLDB 1.5.
    I have a SQL report. One of the columns is based upon LOV - Display as Text (Based on LOV, does not save state).
    For the "Ids" of the report, it should display the corresponding "Names" from the LOV.
    But, for the cases, where no record exist in LOV for some Id, then it is directly showing the Id instead of "-" (which i have specified in Display Null Text) in the report column attributes.
    Before upgrade, it was working fine.
    Any idea where is the issue.
    Please help.
    Thanks in advance,
    Monika

    Hi,
    Can anybody help me in sorting out this issue please.
    For your reference, i have made a test case on
    http://apex.oracle.com/pls/otn/f?p=20451:4:3519837362944582:::::
    Here, there are 2 tables
    1. MY_EMP_COUNTRY(emoid, empname, cntry_id)
    2. MY_COUNTRY_LOOKUP(id, name,active)
    LOV is created on table 2
    select name d, id r
    from my_country_lookup
    where active = 'Y'
    And, on the page a SQL report is created
    select empname, cntry_id
    from my_emp_country
    where, cntry_id is based upon the LOV.
    Since, in lookup table, cntry_id = 4 is set inactive, it is not picked up by the LOV and hence on the report instead of showing the NULL text it is showing the cntry_id (4).
    The attributes of report column cntry id -
    Named LOV = CNTRY_LOV
    Display Null = YES
    NULL text = -
    Display Extra Value = YES
    Am I missing anything.
    thanks,
    Monika

  • Insert rows based on column value

    I have customer_ no., Date and no_months as columns. I need to insert in a new table the customer_no as many times as the value of no_months column. Meaning if customer_no is 001 and if months value is 3 then in the new table I want three rows having customer_no as 001 and the date. Any help is highly appreciated.

    Something like this?
    SQL> with t
      2  as
      3  (select 23 cust_no,3 mon from dual
      4  union all
      5  select 10,9 from dual
      6  union all
      7  select 5,12 from dual
      8  union all
      9  select 7,1 from dual
    10  )
    11  select cust_no,mon
    12  from
    13  (
    14  select cust_no,mon,row_number() over(partition by cust_no order by cust_no) rn from t,dba_tables
    15  )
    16  where rn<=mon
    17  /
       CUST_NO        MON
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
             5         12
       CUST_NO        MON
             5         12
             7          1
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
            10          9
       CUST_NO        MON
            23          3
            23          3
            23          3
    25 rows selected.
    SQL>

Maybe you are looking for

  • Adobe acrobat 7.0 professional installed on windows 8

    With the assistance of Adobe Chat I have downloaded adobe acrobat 7.0 professional to my desktop which has windows 8. Everything works beautifully except when I go on to internet explorer and try to view a pdf document. It says "This page can't be di

  • Installed latest update, and now ipod touch won't work

    Hello, I clicked on the download and install option for the latest update to my ipod touch. I think it was 2.2.1, but I'm not 100% sure. Anyway, now I have to hold the power button down several seconds, and I see the apple logo, and then the itunes i

  • Calibrating Acrobat's on screen full page aspect ratio

    I've had an issue with Acrobat since I started using it at around version 6 up through the current version on both the Mac and Windows that I've not been able to find an answer for though I have searched with all the search terms that I can think of.

  • Payment hasnt gone though?

    So basically I purchased an iPhone 6 online like a week ago, for £619. I got a confirmation and everything and an email to check order status. I checked my bank balance this week, and realised no money has been taken out. So Im really confused, when

  • How to increase font size in captions

    Does anyone know if it is possible to increase the font and size of the captions? Thanks