Development

The human being is the only animal that...

FeuerThoughts - Sat, 2015-05-16 08:41
Last night, I decided to re-read Stumbling on Happiness, a book I'd discovered a few years ago and was (then) delighted with. 

I chose that over one of my (back then) favorite books of fiction, because I'd been thinking yesterday and how odd it is that lots of left-leaning humans are all upset about climate change and really pissed at their elected officials about their non-action on this literally world-changing issue at a time when radical action is necessary - yet they don't take radical action in their own lives.

It's pretty clear that politicians will not change direction (will not override the influence of the source of their funding), until their constituents demonstrate a deep desire for change, backed up by action.

Anyway, there I was wondering once again about humans and why we behave the way we do. And so I sought out some answers in SoH. After all, the renowned Malcolm Gladwell, author of The Tipping Point, says right on the cover: 
"If you have even the slightest curiosity about the human condition, you ought to read it. Trust me."
OK, so fine. If a person says "trust me", usually you want to run in the other direction. But hey....

So I started reading and soon found Daniel Gilbert talking about psychologists are expected sometime in their career to finish The Sentence that starts with "The human being is the only animal that..." and now it was his turn.

Exciting! And then he finished the sentence:
"The human being is the only animal that thinks about the future."
And then you know what I did?

I stopped the reading book - and tossed it into the recycle bin. Yep, I threw the book away. That's how much Gilbert disgusted me, right then and there.

Why? Because of all the things we know about the world and the way it "works", the one thing we can never know is what another animal - even another human - is actually, truly thinking

All we can know, all we can see, all we can measure, and then draw conclusions from, is how an animal manifests their thinking into the world.

Gilbert cites as one "proof" of his Sentence that squirrels will, ahem, squirrel away nuts in advance of winter even in places where they will then find, winter after winter, that nuts or other food remain abundant. 

Go, Gilbert, go! Apply a human frame of judgement onto other animals, sure, why not? Why not assume that means that squirrels don't think about the future, rather than saying: "Maybe they do think about the future and know that they cannot trust what the future will bring, because they are not willing to destroy forests to build houses to hide them from the vagaries of the future."

So I threw out the book, but that got me thinking about The Sentence. I thought I would offer my own variations on that statement and invite others to do the same. Here goes...

The human being is the only animal that:
  • creates garbage, including vast "islands" of plastic in the middle of our oceans
  • causes the extinction of entire species, year in and year out
  • poisons water, the source of all life on this planet
  • learns multiple languages
  • holds it in
And just to pre-empt some typical responses:

The human being is the not only animal that:
  • creates art - lots of birds do, too. Just check out nests of bowerbirds.
  • has a sense of right and wrong - black bears do, too. Just check out Among the Bears. Seriously: READ THIS BOOK.
  • uses tools - birds, chimpanzees and others repurpose stones, branches, etc. as tools
  • is altruistic - again, black bears, and even more so ants. Many species of ants are way more altruistic than humans.
So what can you think of that only a human does? And please don't tell me about your belief about internal states of mind. That's just an opinion. Tell me about what humans do.



Categories: Development

APEX 5.0: There are issues with the configuration of the Static Files in your environment

Patrick Wolf - Thu, 2015-05-14 09:13
After installing Oracle APEX 5.0, do you get the alert “There are issues with the configuration of the Static Files in your environment. Please consult the “Configuring Static File Support” section in the Application Express Installation Guide.” when you try … Continue reading
Categories: Development

Monitoring BRM Host Processes using Metric Extension in EM12c

Arun Bavera - Wed, 2015-05-13 11:01
image

#/bin/sh
export CURRENT_USER=brm
#echo 'PROCESS_NAME'  'COUNT'
for p in dm_oracle cm dm_aq dm_ifw_sync wirelessRealtime.reg
do
CNT=`ps -ef | grep ${CURRENT_USER} | grep ${p} | grep -v grep | grep -v cmmp | wc -l`
echo ${p} '|' ${CNT}
done

image
Categories: Development

APEX 5.0: Upgrade to the newest FontAwesome Icon Library

Patrick Wolf - Wed, 2015-05-13 04:39
Oracle APEX 5.0 ships with FontAwesome version 4.2.0 which will automatically be loaded if your application is using the Universal Theme. This makes it super easy to add nice looking icons to your buttons, lists and regions. But how can you integrate the most … Continue reading
Categories: Development

Leveraging Icon Fonts (Font Awesome) in Oracle ADF - 500 New Icons for your app

Shay Shmeltzer - Thu, 2015-05-07 16:51

Icon fonts are a growing trend among web developers, they make it quite simple to add icons to your web site and resize them for better responsive design.

Font Awesome is a popular open source icon font - providing over 500 icons that you can add to your application. I got several questions over the past couple of weeks about using these icons in ADF applications, so here is a short video showing you how to set this up with ADF 12.1.3 and using skins. (Quick note - before 12.1.3 you couldn't include these type of font in the skin css file - and you would have needed to directly refer to the CSS file from each page in your app - one more reason to upgrade your application to 12.1.3).

The basic steps:

  • Create a new skin for your ADF application (if you don't know how to do this, see this blog entry).
  • Download font awesome and copy the font-awesome-4.3.0 directory into your new skin directory
  • Copy the @font-face entry from the font-awesome.min.css file into your new skin.css file
  • Update the path in the various URI entries so it reflects the new relative location of the font files
  • Create class entries in your skin CSS for the icons you want to use - remember to add a font-family: FontAwesome; to make sure they use the new font.
  • Assign the classes to the styleclass property of your ADF Faces components.

Here is a demo showing how it is set up and how it works:

The skin1.css in the video is this:

@charset "UTF-8";

/**ADFFaces_Skin_File / DO NOT REMOVE**/

@namespace af "http://xmlns.oracle.com/adf/faces/rich";

@namespace dvt "http://xmlns.oracle.com/dss/adf/faces";

@font-face {

    font-family: 'FontAwesome';

    src: url('font-awesome-4.3.0/fonts/fontawesome-webfont.eot?v=4.3.0');

    src: url('font-awesome-4.3.0/fonts/fontawesome-webfont.eot?#iefix&v=4.3.0')format('embedded-opentype'), url('font-awesome-4.3.0/fonts/fontawesome-webfont.woff2?v=4.3.0')format('woff2'), url('font-awesome-4.3.0/fonts/fontawesome-webfont.woff?v=4.3.0')format('woff'), url('font-awesome-4.3.0/fonts/fontawesome-webfont.ttf?v=4.3.0')format('truetype'), url('font-awesome-4.3.0/fonts/fontawesome-webfont.svg?v=4.3.0#fontawesomeregular')format('svg');

    font-weight: normal;

    font-style: normal;

}

.heart:before {

    content: "\f004";

    font-family: FontAwesome;

}

.mail:before {

    content: "\f003";

    font-family: FontAwesome;

If you want to see how this could help with responsive design try this in your CSS as an example. Then resize the width of the browser window to see how the icons will change their size dynamically:

.heart:before {

    content: "\f004";

    font-family: FontAwesome;

    font-size: x-large;

}

.mail:before {

    content: "\f003";

    font-family: FontAwesome;

    font-size: x-large;

}

@media screen and (max-width:950px) {

    .heart:before {

        content: "\f004";

        font-family: FontAwesome;

        font-size: small;

    }

    .mail:before {

        content: "\f003";

        font-family: FontAwesome;

        font-size: small;

    }

Categories: Development

APEX 5.0: Universal Theme Migration Guide available!

Patrick Wolf - Thu, 2015-05-07 03:59
Do you want to use the new Universal Theme for your existing applications? Then you should definitely have a look at the Universal Theme Migration Guide my colleagues Shakeeb Rahman and Tim Chambers have just published.
Categories: Development

APEX 5.0: Custom Favicon for Applications using Universal Theme

Patrick Wolf - Mon, 2015-05-04 07:08
For applications which are using Universal Theme you don’t have to modify the Page Template anymore if you want to replace the default favicon with a custom one. Instead follow these steps: Go to Shared Components Click Application Definition Attributes (in Application … Continue reading
Categories: Development

Our new Oracle APEX YouTube Channel is up and running!

Patrick Wolf - Sat, 2015-05-02 08:12
Check out our new Oracle APEX YouTube Channel! Our Product Manager David Peake has started a Video Series about the new Page Designer in Oracle Application Express 5.0. It’s a great start to get familiarized with the new IDE to edit … Continue reading
Categories: Development

Oracle Developer Cloud Service - Automating Builds for Oracle ADF Applications

Shay Shmeltzer - Tue, 2015-04-28 12:49

Following up on the previous blog that showed how to get your ADF application into the Developer Cloud Service git repository, this entry will show you the next step in the lifecycle - executing builds.

The Oracle Developer Cloud Service (DevCS) supports build automation with both Maven and Ant scripts - and in this demo I'm showing you how to use the Ant option. One of the unique aspects of DevCS for customers who are  using Oracle ADF and JDeveloper is that the cloud comes pre-configured with the ADF libraries needed to compile your code, and also with support for OJDeploy so you can leverage deployment profiles that you defined for your application.

In fact DevCS comes with support for two ADF versions - 11.1.1.7.1 and 12.1.3 (as of the time of this blog).

In the video below you'll see

  • How to add a build file for your ADF application
  • How to  configure the build file to work in the cloud environment
  • How to define a build job and execute it
  • How to look at the log files for the build job
  • How to automate the build execution to happen when changes are committed to the git repository

 

The build in the example above just does the packaging, but in more realistic scenarios you can use similar build processes to create ADF libraries from projects, automate testing, modify configuration and more.

There are a couple of files that are used in the demo that you might want to use in your implementation:

The build.xml file: 

  <property environment="env" /> 
  <property file="build.properties"/>
    <target name="deploy" description="Deploy JDeveloper profiles">
    <taskdef name="ojdeploy"
             classname="oracle.jdeveloper.deploy.ant.OJDeployAntTask"
             uri="oraclelib:OJDeployAntTask"
             classpath="${oracle.jdeveloper.ant.library}"/>
    <ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
                  executable="${oracle.jdeveloper.ojdeploy.path}"
                  ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build.xml"
                  ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog.xml">
      <ora:deploy>
        <ora:parameter name="workspace"
                       value="${oracle.jdeveloper.workspace.path}"/>
        <ora:parameter name="profile"
                       value="${oracle.jdeveloper.deploy.profile.name}"/>
        <ora:parameter name="nocompile" value="false"/>
        <ora:parameter name="outputfile"
                       value="${oracle.jdeveloper.deploy.outputfile}"/>
      </ora:deploy>
    </ora:ojdeploy>
  </target>

The build.properties file I used can be found here.

The mask for the build automatic execution is */1 * * * *

Note that in the properties file there are references to environment variables that you will need to change if you are looking to deploy an 11.1.1.* app - specifically the options for 12 and 11 are:

WLS_HOME_12C3=/opt/Oracle/Middleware12c3/wlserver
WLS_HOME_11G=/opt/Oracle/Middleware/wlserver_10.3
MIDDLEWARE_HOME_12C3=/opt/Oracle/Middleware12c3
MIDDLEWARE_HOME_11G=/opt/Oracle/Middleware
ORACLE_HOME_12C3=/opt/Oracle/Middleware12c3/jdeveloper
ORACLE_HOME_11G=/opt/Oracle/Middleware/jdeveloper

The next logical step in your app lifecycle is to automate the deployment of the ADF application to the Oracle Java Cloud Service. If you are interested in this check out - Automating Deployment of the Summit ADF Sample Application to the Oracle Java Cloud Service

Categories: Development

Little quiz: Ordering/Grouping – Guess the output

XTended Oracle SQL - Tue, 2015-04-28 07:20

How many times have you guessed the right answer? :)

1
select * from dual order by -1;
select * from dual order by 0;

[collapse]
2
select *                   from dual                                     order by -(0.1+0/1) desc;
select 1 n,0 n,2 n,0 n,1 n from dual group by grouping sets(1,2,3,2,1,0) order by -(0.1+0/1) desc;

[collapse]
3
select 1 n,0 n,2 n,0 n,1 n from dual group by grouping sets(1,2,3,2,1,0) order by 0;
select 1 n,0 n,2 n,0 n,1 n from dual group by grouping sets(1,2,3,2,1,0) order by 0+0;
select 1 n,0 n,2 n,0 n,1 n from dual group by grouping sets(1,2,3,2,1,0) order by 3+7 desc;
select 1 n,0 n,2 n,0 n,1 n from dual group by grouping sets(1,2,3,2,1,0) order by -(3.1+0f) desc;

[collapse]
4
select column_value x,10-column_value y from table(ku$_objnumset(5,4,3,1,2,3,4)) order by 1.9;
select column_value x,10-column_value y from table(ku$_objnumset(5,4,3,1,2,3,4)) order by 2.5;
select column_value x,10-column_value y from table(ku$_objnumset(5,4,3,1,2,3,4)) order by 2.7 desc;
select column_value x,10-column_value y from table(ku$_objnumset(5,4,3,1,2,3,4)) order by -2.7 desc;

[collapse]

Categories: Development

Using the Oracle Developer Cloud Service for Git version management for JDeveloper/ADF apps

Shay Shmeltzer - Thu, 2015-04-23 11:35

The Oracle Developer Cloud Service (DevCS for short) provides a complete cloud-hosted development platform for your team. This makes it very easy to start adopting development best practices for your team, and adopt a more agile development approach.

If you haven't tried it yet, you should!

It's simple to get a free trial instance - just sign up for a trial of the Java cloud service (which, by the way, will take you through anOracle ADF based registration wizard) and an instance of the Developer cloud service will be provisioned for you as part of the trial. No need for any additional machines or installations on your side.

I'm going to write a couple of blogs about the various features that DevCS provides such as build and continuous integration, but let's start with the very basic feature we all should be using - source code management.

Every project needs to do version management - even if you are a single developer - and with DevCS there is no server and network setup required. Create a new DevCS project and 10 seconds later you have your git server accessible from any computer that has internet access.

The demo below is using JDeveloper 12.1.3 and the sample summit ADF application that you can get from OTN. 

In the demo I start from scratch and demo how to

  • create a new DevCS project
  • check code into the git repository
  • branch my code to work on fixes
  • submit the changes back
  • how to do code review by team members
  • merge fixes to the master branch

 

Go ahead try it out with your project and your team.

If you are new to git (which has quickly became the new standard for source management) - check out the Oracle A-Team blog entry that explains a good workflow for team work with git that you can adopt. 

Have any further questions about using the Developer Cloud Service? Ask them on the DevCS community page

Categories: Development

Dynamically refresh a part of a page (PPR) in Oracle MAF

Shay Shmeltzer - Wed, 2015-04-22 11:23

A common question for developers who are just starting with Oracle MAF, especially if they have a background in Oracle ADF, is how do you do a partial page refresh in Oracle MAF.

Partial Page Refresh basically means that I want to change something in my UI based on another event in the UI - for example hide or show a section of the page. (In ADF there is a partialTrigger property for components which is not there in MAF).

In MAF the UI behaves differently - it is not based on JSF after all - the UI directly reflects changes in managed beans as long as it knows about changes there. How does it know about changes? For this you need to enable firing change event notifications. This is actually quite easy to do - just turn on the checkbox in JDeveloper's accessors generation and it will do the job for you.

Here is a quick demo showing you how to achieve  this:

Here is the code used.

in AMX page:

     <amx:tableLayout id="tl1">

      <amx:rowLayout id="rl1">

        <amx:cellFormat id="cf2">

          <amx:listView var="row" showMoreStrategy="autoScroll" bufferStrategy="viewport" id="lv1">

            <amx:listItem id="li1">

              <amx:outputText value="ListItem Text" id="ot2"/>

              <amx:setPropertyListener id="spl1" from="#{'true'}" to="#{viewScope.backingPPR.showIt}"

                                       type="swipeRight"/>

              <amx:setPropertyListener id="spl2" from="#{'false'}" to="#{viewScope.backingPPR.showIt}"

                                       type="swipeLeft"/>

            </amx:listItem>

          </amx:listView>

        </amx:cellFormat>

      </amx:rowLayout>

      <amx:rowLayout id="rl2" rendered="#{viewScope.backingPPR.showIt}">

        <amx:cellFormat id="cf1">

          <amx:commandButton text="commandButton1" id="cb3"/>

        </amx:cellFormat>

      </amx:rowLayout>

    </amx:tableLayout>


in managed bean:

     boolean showIt = false;


    public void setShowIt(boolean showIt) {

        boolean oldShowIt = this.showIt;

        this.showIt = showIt;

        propertyChangeSupport.firePropertyChange("showIt", oldShowIt, showIt);

    }


    public boolean isShowIt() {

        return showIt;

    }


    public void addPropertyChangeListener(PropertyChangeListener l) {

        propertyChangeSupport.addPropertyChangeListener(l);

    }


    public void removePropertyChangeListener(PropertyChangeListener l) {

        propertyChangeSupport.removePropertyChangeListener(l);

    }


Categories: Development

Enable Real Application Security (RAS) in APEX 5.0

Dimitri Gielis - Mon, 2015-04-20 16:25
Oracle Database 12c introduced Oracle Real Application Security (RAS), the next generation Oracle Virtual Private Database (VPD). In APEX 5.0 RAS is declaratively build-in. Follow the below steps to enable it:

Login to the INTERNAL workspace and go to Manage Instance > Security:

In the Real Application Security section set Allow Real Application Security to Yes.

Next login to the Workspace your Application is build in and go to your Authentication Scheme.
You'll see a new section in there called Real Application Security.



The dropdown has following possibilities:

  • Disabled: Real Application Security does not get used in the application. 
  • Internal Users: APEX creates a RAS session and assumes that all users are internal and passes false via the is_external parameter to dbms_xs_sessions.assign_user. 
  • External Users: RAS session created and true gets passed via the is_external parameter to dbms_xs_sessions.assign_user. 

The last two options enable RAS Mode and make the Dynamic Roles and Namespaces shuttle available. (from the help in APEX) Make sure that the users get privileges to access the application's schema objects. For External Users, you can for example grant database privileges to a RAS Dynamic Application Role and configure it in this authentication scheme as a Dynamic Role. You can also enable roles via a call to apex_authorization.enable_dynamic_groups, e.g. in a Post-Authentication procedure.

You can read more about Oracle Real Application Security and view an entire example how to set up RAS at the database side. I'm still learning about all the RAS features myself too, but thought to already share the above. I plan to include a chapter in my e-book about RAS and APEX 5.0 with a real-case example, as I see a big benefit for using it in a highly regulatory, secure and audited environment.


Categories: Development

JSON for APEX Developers (part 3): Querying JSON in Oracle DB 12c

Dimitri Gielis - Fri, 2015-04-17 10:34
In previous blog posts I talked about JSON for APEX Developers:
In this post I want to show how you store and query JSON data straight in the database.

To start, create a table to store the JSON object:

CREATE TABLE ssn_json
   (id          NUMBER GENERATED ALWAYS AS IDENTITY NOT NULL,
    date_loaded DATE,
    json_document CLOB
    CONSTRAINT ensure_json CHECK (json_document IS JSON));


I inserted a couple of records in the table:


Here's in more detail the JSON in the json_document column:

Now to query the JSON data I can do :


You basically say j (table) . json_document (column) . analyses (first entry in JSON) . ... (other fields of the hierarchy you want to navigate to)
 
You see the data I get back is actually two records as I actually get back the JSON array.

To go into the array and see for example the first record, I can use json_value:


Note that the array start with 0.

And finally to see both records that are in the JSON array I can make use of json_table like this:


The above is just a grasp of what you can do with JSON directly in the database (12c) by using SQL.
If you're interested to read more about how to manipulate JSON in the database, have a look at the documentation, it contains a wealth on information with great examples.

As you can basically query the JSON with SQL you can use this SQL in your APEX reports... in the coming days I'll show you a real case where I used the above techniques to do some interesting searching in data.
Categories: Development

Oracle APEX 5.0 released today

Dimitri Gielis - Wed, 2015-04-15 15:34
After 2.5 years of development, today is the day APEX 5.0 is publicly released and ready to be downloaded to install on your own environment.

In my view it's the best release ever. Not so much of the new Page Designer - although that is definitely a piece of art and it increased productivity even further - but because it's the first time whole of APEX got refreshed and every piece was put under a radar to see how it could be improved. All the small changes and the new UI, together with the Page Designer makes it a whole new development tool, without losing it's strengths from before.

Also note that APEX 5.0 enables many new features build on top of the Oracle Database 12c features, so if you're on that database, you'll see even more nice features.

If you wonder if you should wait with upgrading to APEX 5.0 because you're afraid that your current APEX applications break, I can only share that I upgraded many of my applications as part of EA/beta and most of my apps kept running without issues. As always you have to try your applications yourself, but the APEX development team spend a lot of time trying to keep things backwards compatible. But make sure to have a look at the APEX 5.0 release notes and known issues as they contain important information about changes, expected behaviour and workarounds.

You can develop online on apex.oracle.com or you can download APEX 5.0 and install into your own environment.
Categories: Development

Oracle APEX 5.0 Available for Download!

Patrick Wolf - Wed, 2015-04-15 12:43
After a longer development cycle than usual, Oracle Application Express 5.0 is finally available for download! I think it was worth the wait. It comes with a ton of features, here are just a few marquee features. Page Designer Universal … Continue reading
Categories: Development

APEX 5.0: Set Cursor Focus for Region Type Plug-Ins

Patrick Wolf - Tue, 2015-04-14 08:19
Complex Region Type Plug-ins might render their own input fields, like our Interactive Report component does with the search field. If a developer had set the page level attribute Cursor Focus to First item on Page in Oracle APEX 4.x, … Continue reading
Categories: Development

In what ways is buckthorn harmful?

FeuerThoughts - Sun, 2015-04-12 17:54
I spent 10-15 hours a week in various locations of still-wooded Chicago (and now nearby Lincolnwood) cutting down buckthorn. Some people have taken me to task for it ("Just let it be, let nature take it's course, etc.). So I thought I would share this excellent, concise sum up of the damage that can be wrought by buckthorn.

And if anyone lives on the north side of Chicago and would like to help out, there is both "heavy" work (cutting large trees and dragging them around) and now lots of "light" work (clipping the new growth from the stumps from last year's cutting - I don't use poison). 

It's great exercise and without a doubt you will be helping rescue native trees and ensure that the next generation of those trees will survive and thrive!


Buckthorn should be on America's "Most Wanted" list, with its picture hanging up in every US Post Office! Here are a few of the dangers of Buckthorn:

a) Buckthorn squeezes out native plants for nutrients, sunlight, and moisture. It literally chokes out surrounding healthy trees and makes it impossible for any new growth to take root under its cancerous canopy of dense vegetation.

b) Buckthorn degrades wildlife habitats and alters the natural food chain in and growth of an otherwise healthy forest. It disrupts the whole natural balance of the ecosystem.

c) Buckthorn can host pests like Crown Rust Fungus and Soybean Aphids. Crown Rust can devastate oat crops and a wide variety of other grasses. Soybean Aphids can have a devastating effect on the yield of soybean crops. Without buckthorn as host, these pests couldn't survive to blight crops.

d) Buckthorn contributes to erosion by overshadowing plants that grow on the forest floor, causing them to die and causing the soil to lose the integrity and structure created by such plants.

e) Buckthorn lacks "natural controls" like insects or diseases that would curb its growth. A Buckthorn-infested forest is too dense to walk through, and the thorns of Common Buckthorn will leave you bloodied.

f) Buckthorn attracts many species of birds (especially robins and cedar waxwings) that eat the berries and spread the seeds through excrement. Not only are the birds attracted to the plentiful berries, but because the buckthorn berries have a diuretic and cathartic effect, the birds pass the seeds very quickly to the surrounding areas of the forest. This makes Buckthorn spread even more widely and rapidly, making it harder for us to control and contain.
Categories: Development

Consumer Reports guide on which fruits and veggies to always buy organic

FeuerThoughts - Mon, 2015-04-06 10:32
First, I encourage everyone reading this (and beyond) to subscribe to Consumer Reports and make use of their unbiased, science-based reviews of products and services.

It is the best antidote to advertising you will ever find.

In their May 2015 issue, they analyze the "perils of pesticides" and offer a guide to fruits and vegetables. When you should buy organic? When might conventional be OK for you?

[or, as CR puts it, "Though we believe that organic is always the best choice because it promotes sustainable agriculture, getting plenty of fruits and vegetables - even if you can't obtain organic - takes precedence when it comes to your health.]

Here are the most important findings:

ALWAYS BUY ORGANIC

CR found that for these fruits and vegetables, you should always buy organic - the pesticide risk in conventional is too high.

Fruit

Peaches
Tangerines
Nectarines
Strawberries
Cranberries

Vegetables

Green Beans
Sweet Bell Peppers
Hot Peppers
Sweet Potatoes
Carrors
Categories: Development

Working with multiple Trees on the same APEX Page (4.2/5.0)

Dimitri Gielis - Mon, 2015-03-16 16:36
Ever tried to put multiple Trees on the same page in APEX 4.2?

Here's my example:


On the left Tree the "Selected Node Link with" is set to hidden item P1_TREE1, on the right Tree the value that sets the tree is set to P1_TREE2. At least it should do that, but by default if you're values are not unique - in this case empno is the value behind both trees - it doesn't work...
Your first tree will be highlighted twice; one time for ALLEN and one time for SCOTT and not as it should be, on the left ALLEN selected and on the right SCOTT selected.

To fix this issue in APEX 4.2, you need to adapt your select statement so you have unique values for both trees. I typically put a meaningful character in front of the value; for example you can concatenate 'N' for new values (new tree) and 'O' for old values (old tree).


So that fixes the issue of the "Selected Node Page Item" issue with non unique values.
Behind the tree implementation in APEX 4.2, jsTree is used. APEX is not using the most recent version and the way the JavaScript is coded doesn't really work that nicely. If you really like jsTree and for example want to search in it, or you have a very large dataset, check out Tom Petrus' tree plugin and explanation.

So what about APEX 5.0? The tree implementation in APEX 5.0 has the same functionalities, but is a lot better. Behind the scenes jsTree is not used anymore, instead the tree that is also used in the Page Designer is used. The issue with unique values is off the table, so no worries anymore in APEX 5.0.


Categories: Development

Pages

Subscribe to Oracle FAQ aggregator - Development