Development

Oracle ABCS - Traversing Relationships, Conditional Navigation, Query and Update with JavaScript

Shay Shmeltzer - Mon, 2016-12-19 11:02

Oracle Application Builder Cloud Service (ABCS) lets you do a lot of things in a declarative way, however for more complex validation and conditional logic you might need to resort to some basic coding in JavaScript.

I ran into such a case with an application I was developing, and figured out that the code sample from that system will be a good way to illustrate some coding techniques in ABCS.

The application I was working on allows people to register to various events. Each event has a certain capacity, so if there are too many people registered to an event, we want the rest to be added to a wait list. For each record of a person registering, we keep a reference to the event they want to attend.  So the logic flow is:

  1. Check how many open spaces are available for the event we are trying to register for.
  2. If there is space in the event, save the new person data, and show a success message.
  3. If there isn't space, update the person "Waitlisted" field to be true, save the data, and show a message saying that the person is on the wait list. 

 

In the demo video below I'm showing how to:

  • Define declarative conditional flow of steps based on results from custom code
  • Traverse relationships between custom object through code
  • Execute a conditional query and run through the results from a custom object with code
  • Set the value for a property of a custom object through code

For reference here is the complete code from the sample:

require([
    'operation/js/api/Conditions',
    'operation/js/api/Operator'
], function (Conditions, Operator) {
    var lab = Abcs.Entities().findById('Lab');
    var id = lab.getProperty('id');
    //condition is to find a lab with the id that is in the page's drop down box
    var condition = Conditions.SIMPLE(id, Operator.EQUALS, $Person.getValue('ref2Combo_Box'));
    var operation = Abcs.Operations().read({
        entity: lab,
        condition: condition
    });
    //if query returned value we loop over the rows and check the capacity and registration columns
    operation.perform().then(function (operationResult) {
        if (operationResult.isSuccess()) {
            operationResult.getData().forEach(function (oneRecord) {
                if ((oneRecord.Capacity - oneRecord.Registered) < 1) {
                    $Person.setValue('Waitlisted', true);
                    reject("error");
                } else
                {
                    resolve("ok");
                }
            });
        }
    }).catch(function (operationResult) {
        if (operationResult.isFailure()) {
            // Insert code you want to perform if fetching of records failed
            alert('didnt worked');
            reject("error");
        }
    });
});

More information on the JavaScript APIs used here are in the Oracle ABCS Documentation.

Categories: Development

A Guide to the Oracle UPDATE Statement

Complete IT Professional - Mon, 2016-12-19 05:00
Have you ever needed to update data that was already in a table in Oracle? Learn how to do this with the Oracle UPDATE Statement. What Is the Oracle UPDATE Statement? The Oracle SQL UPDATE statement allows you to change data that is already in a table in SQL. The INSERT statement lets you add […]
Categories: Development

Start to develop in APEX 5.1, you will gain at least an hour a day!

Dimitri Gielis - Sat, 2016-12-17 05:19
Yesterday APEX 5.1 (5.1.0.00.43) was installed on apex.oracle.com.
This means that you can start developing your apps in APEX 5.1 from now on. Unlike the early adopter releases (apexea.oracle.com) you can develop your apps on apex.oracle.com and later export them and import in your own environment once the on-premise version of APEX 5.1 is available.

APEX 5.1 is again a major update behind the scenes. The page processing is completely different from before; where previously full page reloads were done, now there's much more lightweight traffic and only necessary data is send across.

The big features in this new release are the introduction of Interactive Grids, which is both a successor for Interactive Reports as for Tabular Forms. The other big feature is the integration of Oracle JET, which you see mostly in the data visualisation (charts) part of APEX, but more components will probably follow in future versions. Although those two features addresses the most common issues we previously had (outdated tabular forms and charts), APEX 5.1 brings much more than that. Equally important for me are the "smaller" improvements which makes us even more productive. Below you find some examples...

When creating a new application, the login page is immediately a great looking page:


Previously in APEX 5.0 you had to adapt the login page, see my blog post Pimping the Login Page.

When you want your item to look like this:


APEX 5.1 has now a template option to display the Pre and Post text as a Block:


Or when you want an icon inside your item, there's an Icon CSS Class option selector which shows the gorgeous looking new handcrafted Font APEX icons:



You could do all the item customisations above in APEX 4.2 or 5.0 too, but it would require custom css and some code, whereas now it's declarative in APEX 5.1.

And there's so much more; ability to switch style by user, new packaged apps, warn on unsaved changes, no reload page on submit etc. features that haven't been talked about much yet, but which before you had to do with a plugin or a lot of custom code and now it's just there.

So those "smaller" features are actually not so small, they are an enormous timesaver and bring your apps in warp-speed to modern and great looking applications.

In the next blog posts I'll go in more detail on some specific features that will gain you at least an hour a day, but in the meantime, embrace APEX 5.1 and start earning those extra hours :)
Categories: Development

Oracle SQRT Function with Examples

Complete IT Professional - Fri, 2016-12-16 05:00
In this article, I’ll explain the Oracle SQRT function and show you some examples. Purpose of the Oracle SQRT Function The purpose of the Oracle SQRT function is to find and return the square root of a provided number. The square root of a particular number answers this question: “Which number, when multiplied by itself, […]
Categories: Development

Oracle LNNVL Function with Examples

Complete IT Professional - Thu, 2016-12-15 05:00
In this article, I’ll explain what the Oracle LNNVL function does and show you some examples. Purpose of the Oracle LNNVL Function The purpose of the LNNVL is to perform a “logical not null” on the expression that has been provided. It allows you to evaluate data that contains a NULL value, which is something […]
Categories: Development

Markus Winand on Database Optimizers

Gerger Consulting - Tue, 2016-12-13 19:52
If you are a DBA or a developer and would like to learn more about database optimizers, there is no one better in the world than Markus Winand to learn from!



Markus is hosting a free webinar on December 15th. Attend his webinar and learn how you can build better performing applications.

Register at this link.

Categories: Development

Why You Need a Long Term Career Plan and How to Create One

Complete IT Professional - Mon, 2016-12-12 19:57
Why should you have a career plan? Do you even need to know what your job will be in the long term? Learn why and how to create a career plan in this article. The answer is “yes”. You need to know what your career will look like, long term. Or at least have an […]
Categories: Development

A Guide to the Oracle ALTER TABLE SQL Statement

Complete IT Professional - Mon, 2016-12-12 05:00
The Oracle ALTER TABLE statement allows you to make changes to an existing table. Learn how to use it and see some examples in this guide. What Is The Oracle ALTER TABLE Statement? The ALTER TABLE SQL statement lets you change a table that has already been created. Using the CREATE TABLE statement lets you create […]
Categories: Development

Oracle LN Function with Examples

Complete IT Professional - Fri, 2016-12-09 05:00
In this article, I’ll explain what the Oracle LN function is, and show you some examples. Purpose of the Oracle LN Function The purpose of the Oracle LN function is to calculate the natural logarithm of a number. if you’re not sure what the natural logarithm means, you can read more here. I’m not a […]
Categories: Development

Oracle TAN Function with Examples

Complete IT Professional - Thu, 2016-12-08 05:00
In this article, I’ll explain the Oracle TAN function, what it is, and show you some examples. Purpose of the Oracle TAN Function The purpose of the Oracle TAN function is to calculate the tangent of a number. The tangent is ratio of the length of the side opposite the angle to the length of the […]
Categories: Development

Oracle Certification Dumps Can Ruin Your Career

Complete IT Professional - Mon, 2016-12-05 05:00
Are you looking to get certified? Want to get your hands on some Oracle certification dumps for an exam to help you pass? That’s a bad idea. I’ll explain why in this article. What Is a Brain Dump? So what is a brain dump, when you talk about IT certifications? A brain dump is a […]
Categories: Development

New York OUG Winter Event

Gerger Consulting - Fri, 2016-12-02 11:55
On December 7th, Gitora founder Yalim Gerger will be at the NYOUG Winter Event to talk about version control of PL/SQL using Git. Click here for the full agenda. We hope to see you there!


Categories: Development

Oracle SIN Function with Examples

Complete IT Professional - Fri, 2016-12-02 05:00
In this article, I’ll explain what the Oracle SIN function is and show you some examples. Purpose of the Oracle SIN Function The purpose of the SIN function is to calculate the sine of a number. The sine is the ratio of the length of the side of the triangle opposite the angle to the […]
Categories: Development

Oracle COS Function with Examples

Complete IT Professional - Thu, 2016-12-01 05:00
In this article, we look at the Oracle COS function and see some examples. Purpose of the Oracle COS Function The COS function will return the cosine of a number. If your knowledge of cosine is a bit rusty (like mine), then you might find this definition helpful.   Syntax The syntax of the COS […]
Categories: Development

Video&Slides: Version Control for PL/SQL

Gerger Consulting - Mon, 2016-11-28 18:45
Last week we hosted a webinar about how PL/SQL developers can manage their PL/SQL code bases with Gitora, the version control tool for PL/SQL. Many thanks to everyone who attended. You can watch the recording of the webinar and view the slides below.

The webinar consist of two parts:

1) Version Control Strategies for PL/SQL
2) Live Demo of Gitora

Video:



Slides:

Categories: Development

11 Tips to Improve Focus and Concentration at Work

Complete IT Professional - Mon, 2016-11-28 05:00
Do you often find yourself not focusing at work? Or, you try to focus, but something else comes along and distracts you? I know how this feels. I’ve listed eleven ways to remove distractions and increase focus in this article. I’ve been able to improve my focus by removing some of the distractions I have […]
Categories: Development

A Guide to the Oracle DROP TABLE Statement to Delete Tables in SQL

Complete IT Professional - Mon, 2016-11-28 05:00
How can you delete a table in SQL? Learn how to do this by using the DROP TABLE statement in this article. How Can I Delete a Table in Oracle SQL? To delete a table in Oracle SQL (or any SQL for that matter), you run a statement called DROP TABLE. It’s called DROP because […]
Categories: Development

Oracle VARIANCE Function with Examples

Complete IT Professional - Thu, 2016-11-24 05:00
In this article, I’ll explain what the Oracle VARIANCE function is, and show you some examples. Purpose of the Oracle VARIANCE Function The purpose of the VARIANCE function is to, well, return the variance of a set of numbers. A variance is a mathematical concept, which represents how different the values are in a set […]
Categories: Development

Oracle CORR Function with Examples

Complete IT Professional - Tue, 2016-11-22 05:00
In this article, I’ll explain what the Oracle CORR function does and show you some examples. Purpose of the Oracle CORR Function The Oracle CORR function returns the “coefficient of correlation” of a set of number pairs. What is a coefficient of correlation? Here’s an definition of what it means. This function can be used […]
Categories: Development

Version Control for PL/SQL webinar now at 376 signups!

Gerger Consulting - Mon, 2016-11-21 13:59
Many thanks to 376 people who have registered already!

We are hosting a free webinar to talk about how to manage PL/SQL code bases. Attend and learn how you can use Gitora, our new product that links Oracle Database to Git, to manage your PL/SQL source code.

Register at this link.


Categories: Development

Pages

Subscribe to Oracle FAQ aggregator - Development