The power of Dynamic Actions in APEX

In this post I would like to talk about a few configuration items in the Dynamic Actions that could make reduce your need to code basic interactions even further.

Selection Type: jQuery Selector and Javascript Expression

  • Do you have multiple elements that need the same action?
  • Are your page’s elements not accessible by the items, buttons, regions or columns selection type?
  • Does your page region have plain HTML and you want it to use Dynamic Actions?

If you said yes, then I highly suggest you take a look below:

jQuery Selector:

The easiest of the 2. You just need to add the selector that will capture the element(s) you need.

You don’t know how to use a selector? Here are a few tips

  • If your apex item has a static ID with the value element-x , you can write #element-x (yes, hashtag include)
  • If you want create a global action that will do or check something, you can write just body

Selecting elements is a powerful tool and to understand them better, I recommend reading more about it in https://learn.jquery.com/using-jquery-core/selecting-elements/.

JavaScript Expression:

Alright, let’s say that your search criteria is so complex that selectors won’t do it. Or maybe you have to validate something in the elements beforehand. If that is the case you can fallback to the JavaScript Expression which allow you to grab DOM elements, apply logic and return processed items to be selected.


Event Scope

The event scope is an awesome tool that allow us to do dynamic binding, which, to the best of my knowledge remove the need for adding event directly into the HTML code because it continues to work even after Pagination, Refresh adding new items, etc…

I am 99% sure that this comes from the jQuery ‘on’ event with delegate. Anyways, here are some tips

  • By selecting it, the Static Container (jQuery Selector) will become available. Please make sure it is an HTML element that DOES NOT get updates with AJAX. Usually you are safe with regions (give them a static id) and in the last case the <main> or <body> tags. But always try the region first
  • IMPORTANT: In the ‘when’ section, if you are using a jQuery Selector as well, make it not including the container itself.

Client-side vs Server-side Conditions

I’ve seen this with many clients, they are not the same!!!! The only thing they have in common is the name.

Client-side Condition: Is the equivalent of adding an IF clause to you Dynamic Action this allows you to better leverage the low code side of APEX. When adding a condition, you can redirect to the TRUE or FALSE actions.

Server-side Condition: The server-side condition does the same thing to DAs that it does for other components, if true the server will render/send it to the user’s machine, otherwise it won’t. There no true and false and the actions won’t work because the Dynamic Action doesn’t exist to be bound to the element.

Conclusion

As you can see, with APEX you probably don’t need to add external JavaScript or bind events directly on the HTML tag which helps to keep your low code also clean from mundane taks.

Oracle APEX List of Values and Popup Lov

Most people don’t know, but Oracle APEX List of Values (LoV) are very flexible components with that allows us to perform a series of actions using a centralized and reusable data source.

In this post, I’ll be briefly talking about some of the amazing functionalities this tool provides us.

Multi column view

After creating the LoV you can scroll down to Additional Columns and add all columns available in your original select. This columns will become available Popup LoV when the user clicks on it to find an item.

The nice thing about this feature is that you can toggle if the column is visible, searchable and even add a format mask.

And don’t worry, if you use the same LoV for Select Lists items, it will still get its configuration from the Display / Return Value fields.

Subscription

If you have one or just a few Apps in you workspace, you probably never did a subscription. But this is a great way to have a “Master List App” that all other apps listen to get updates.

The interesting thing to note is that the subscription needs to be refreshed by the Publisher or Subscriber, it doesn’t happen automatically. For this reason it allows you test it before letting the code propagate to other applications.

JavaScript Initialization

For those who know JavaScript, you can modify the initialization object and return it with a new configuration.

Although Oracle APEX has dropped jQuery UI, it still uses the same OPTIONS object that you can learn more about in here https://api.jqueryui.com/dialog/

 

Additional Outputs

Going back to my first tip when I mentioned multiple columns, in addition to that, you can set the value of multiple page items by using said columns. The interface here is a bit too compact, but from the example you can see the pattern. Column name : page item, another column : another page item.

 

Conclusion

As you can see, the List of Value and Popup LoV are 2 powerful features that allow us to quickly develop without gaving to worry too much about standard list components (and some not so standard as well). I could probably write much more on the subject, but that will probably stay for another post 😉

DOAG DEV TALK ZUM THEMA “PL/SQL VS. JAVASCRIPT”

NEU: “DOAG Dev Talk”-Reihe

Thema: PL/SQL vs. JavaScript

Referenten: Kai Donato & Moritz Klein

Moderation: Niels de Bruijn, Leiter der Dev-Community

Einen Link zur Anmeldung stellen wir zeitnah zur Verfügung!

DOAG DEV TALK ZUM THEMA “JAVASCRIPT IN APEX?”

NEU: “DOAG Dev Talk”-Reihe

Thema: JavaScript in APEX?

Referenten: Kai Donato & Carolin Hagemann

Moderation: Niels de Bruijn, Leiter der Dev-Community

Einen Link zur Anmeldung stellen wir zeitnah zur Verfügung!

JWT: tudo o que não falaram para você sobre…

Javascript Object Signing and Encryption (JOSE) é um framework. É nessa família que encontramos o JWT (JSON Web Token) e seus componentes.

Neste evento ONLINE e GRATUITO no Canal .NET iremos abordar todos os componentes da família JOSE: JWA, JWK, JWE, JWKS. E como esse framework é o coração da segurança do OAuth2 & OpenId Connect. Além disso serão discutidos outros cenários de uso, como integrações de APIs!

Palestrante: Bruno Brito (Microsoft MVP)

Não deixem de acompanhar! Convidem amigas, amigos e colegas de trabalho!

Gerando código com C# Source Generators

No C# 9 tivemos o lançamento dos source generators, que permitem uma espécie de metaprogramação na linguagem e gerando código adicional com base na implementação que você já possui.

Acompanhe neste evento ONLINE e GRATUITO no Canal .NET o que é possível fazer com source generators em C# e onde você os usaria.

Palestrante: Giovanni Bassi (Microsoft MVP)

Não deixem de acompanhar! Convidem amigas, amigos e colegas de trabalho!

APEX CONNECT 2021 [ONLINE]

Die APEX connect 2021 [online] heißt euch am 4. und 5. Mai zum großen Wiedersehen der Community willkommen – bequem und sicher von Zuhause oder dem Büro aus. Freut euch auf zahlreiche Vorträge und Workshops zu den Themen APEX, JavaScript und PL/SQL! Wir bieten euch ein einzigartiges Online-Konferenzerlebnis mit jeder Menge Wissensaustausch, Networking und einem unterhaltsamen Abendprogramm.

APEX Office Hours

APEX + Server-side JavaScript = Awesome!

Welcome to the future! Starting with Oracle Database 21c, developers can now execute JavaScript within the database. This functionality is enabled by the Multilingual Engine (MLE), powered by GraalVM. And APEX 20.2 is the first (and only) low code framework on the planet which natively supports server-side JavaScript, out of the box!

In this special edition of Oracle APEX Office Hours, we will be joined by Lucas Braun, Program Manager for GraalVM and part of the esteemed Oracle Labs team, and Stefan Dobre, who is a developer at FOEX AT and a respected luminary in the Oracle APEX community. They will:

1) Present MLE and what you can do with server-side JavaScript in APEX
2) Provide numerous real-world demonstrations
3) Show you everything you need to do so that you can try this yourself today, and for free in an Always Free Oracle Database

javascript:apex.confirm

The most simple way to ask for your user attention, is to popup a javascript browser question. Something like “Do you really wanna proceed?”

In the APEX world, just remember You do not need to reinvent the wheel!
Let’s use the native apex javascript Api, that comes with the function named Confirm, which ask user for a confirmation, before to submit page or before run some process.

Easy Example

First, select the button you want this behavior, then set the property Target to URL.
Second, set the target url to below javascript code, and don’t forget to adapt the message for your need’s.

   javascript:apex.confirm('Delete the user &APP_USER. Really?', 'DELETE');

The second parameter can be used to set the value of REQUEST, when the page is submitted. You can use this value selectively run some Process point,  setting the property Condition to “when request = value”.

Complex Example

For more complex needs, you can set Apex Items values, before to proceed with page submit. In this case, the second parameter should be an Object, with all items and values necessary for your page flow and correct process.

   javascript:apex.confirm("Save Department?", {
       request:"SAVE",
       set:{ "P1_DEPTNO":10, "P1_EMPNO":5433 } } );

 
Cassiano.