Monday, August 15, 2016

Apex report: Conditionally showing the link url

Apex report: Conditionally showing the link url

Sometime in the report/form combination, we will need to show/hide the linked url based on value of another col of the report, for example, in following report:

select empno,ename,job from emp;

There is a link on the empno col, (the link will point to the EMP detail form). What I would like to do is to only enable the link if the person's job title is 'Manager', otherwise hide the link.

Here is how to do it:

1. Modify the report sql to:
     select empno,ename,job,decode(job,'Manager','Y','N') flag from emp;
2.  in the report page(inline css section), put this in:
     .N { display: none; }
3. in the linked attribute of the report linked col, put this in
    class="#flag#"

That't IT!

In case you are not happen with the default edit icon, you can replace with a dynamic action on the report page:

create a dynamic action(after refresh), run javascripts:

$(".Y").removeClass("Y").addClass("fa fa-user-plus fa-2x")

In this case, I am replacing the default edit link icon with an font awesome icon

Tuesday, August 9, 2016

Apex Tabular Form -- disable one column based on value of another column

Apex Tabular Form -- disable one column based on value of another column


I have a Tabular Form, one col is an LOV(Phone MMS provider), another col is a text field, I would like to disable that text column if user doesn't choose "Other" in the LOV, otherwise make it enterable. 

Here is how to do it:

1. create a dynamic action:
    Event: Change on JQuery selector:  select[name='f08'] --- here f08 is the LOV field
    execute javascripts:
      var lov = this.triggeringElement.id;
      var row = lov.split("_")[1];
      if ($lov(el)  == "Other") {
      // disable the field 
       //       $x_disableItem("f09_" + row, false);  --- change this to below line, because I got no data found issue with this line after I added more than 16 rows in the tabular table, not sure the reason but changed it to below fixed the issue
              $( "#f09_" + row ).prop( 'readOnly', false);
      }
      else {
     // enable the field
     //        $x_disableItem("f09_" + row, true); ---- Change this to below line
             $( "#f09_" + row ).prop( 'readOnly', true);
      };

 --- f09 is the text field in the tabular form
2. copy the dynamic action, change the event to "Page Load"

Tuesday, July 26, 2016

Oracle Apex 5: Show fontawesome in Report

Oracle Apex 5: Show fontawesome in Report

Say I have a report with a column "NOTIFICATION", which will have Yes or No value, if I want to show  fontawesome instead of Yes/No in the report, do these:

1. Put following css into page inline css(or global css file):

.check-Yes:before {
 content: "\f00c";
 color: green;
}
.check-No:before {
 content: "\f00d";
 color: red;

--- for other fonts, you can check it and choose the one you want here http://fontawesome.io/cheatsheet/

2. Modify the notification column in the report, put following into the  HTML expression sections

<span class="fa check-#NOTIFICATION# fa-2x"></span>

That's IT.

Thursday, July 21, 2016

Apex 5: Change Badge List hover default color

Apex 5: Change Badge List hover default color


I am doing an project where I am using the Badge List Plugin come with the Apex packaged application, customer want to change the hover color from default to Teal, I tried to find the jquery class think it shall be easy to do that but it took me a while to figure it out:

Here is how to get it done:

In the page inline css section, put this part(Here I am changing the hover color from default to Teal color):

.t-BadgeList--circular a.t-BadgeList-wrap:hover .t-BadgeList-value {
    box-shadow: 0 0 0 4px Teal inset;
}

.t-BadgeList--circular a.t-BadgeList-wrap .t-BadgeList-value {
    border-color: Teal;
    transition: box-shadow 0.1s, color 0.1s, background-color 0.3s;
}

I somehow couldn't get the class through inspector which I originally thought I could, I end up looking  at https://apex.oracle.com/ut, which has all the Universal Theme component, where I can get this easily..


Thursday, June 23, 2016

ORDS Query Based REST Service

ORDS Query Based REST Service



Today I found one wire thing:

I am using Oracle ORDS (3.0) amd Sql*Developer(4.0) to create a get service based on an simply Sql query(cursor expression included), I following the instruction of Sql*developer but somehow the service just didn't work, keep giving "Service Denied" error.

After some digging, it turns out that there is one parameter "Pagination Size" which is having default size 25, which need to be set to 0 in order to make it work. I haven't find any reason for that yet but that's the way it is

Monday, April 25, 2016

Oracle Apex Tabular Form delete new rows without submitting

A very good way from:

http://techxploration.blogspot.com/2013/08/oracle-apex-tabular-form-delete-unsaved.html


1. Put this in the Global Function:


function delete_rows(){
    var need_submit = 0;
    $("[name='f01']").each(function(){
    if($(this).attr("checked")) {
       if(this.value == 0) // new rows {
           $(this).closest("tr").remove();
       }
       else  {  //existing rows, need to be removed via page submission.
           need_submit = need_submit + 1;  
       }
     });   
     if(need_submit > 0)    // require submission?
        apex.confirm('Are you sure you want to delete it?','DELETE');
        apex.submit('APPLY_CHANGES_MRD'); 
    };

2. in the Button, put "redirect URL" and put this as target:

    javascript:delete_rows();

Wednesday, April 13, 2016

Sending email from sqlplus(pl/sql) using Apex_mail

declare
  wspace_id number;
begin

  select max(workspace_id) into wspace_id from apex_applications ;
  wwv_flow_api.set_security_group_id(wspace_id);

  apex_mail.send (
    p_from => 'me@test.com'
    , p_to => 'me@test.com'
    , p_subj => 'Send email from Pl/Sql using Apex_mail'
    , p_body => 'test test'
   );

  apex_mail.push_queue('mail.url.com', 25);
end;