# A quick look at APEX 22.2 - Dynamic Actions, Number field, Template Directives, Session State

# What's new in APEX 22.2

After having gone through some of the APEX 22.2 new features in details, here I will share with you some others that would greatly improve the developer experience in first place. My reviews so far of the APEX 22.2 new features:

🔗 [A glimpse of the APEX 22.2 new features - Device Geolocation](https://plamen9.hashnode.dev/a-glimpse-of-the-apex-222-new-features-device-geolocation)

🔗 [A glimpse of the APEX 22.2 new features - Vector Map tiles](https://plamen9.hashnode.dev/a-glimpse-of-the-apex-222-new-features-vector-map-tiles)

🔗 [A glimpse of the APEX 22.2 new features - Autocomplete](https://plamen9.hashnode.dev/a-glimpse-of-the-apex-222-new-features-autocomplete)

🔗 [Make your app stand out using Meta Tags - better SEO and shareability](https://plamen9.hashnode.dev/make-your-app-stand-out-using-meta-tags-better-seo-and-shareability)

> 🔗 [See here the full list of new features in APEX 22.2](https://apex.oracle.com/en/platform/features/whats-new-222/)

# Naming Dynamic Actions 

> You can now specify a custom name for your True or False actions, enabling you to remove the guesswork from selecting the right action within Page Designer.

> View the original [idea request in the APEX Ideas App](https://apexapps.oracle.com/pls/apex/apex_pm/fr/r/FR-2381).

![The new Name input on the True/False action](https://cdn.hashnode.com/res/hashnode/image/upload/v1666883203683/laqXTlP6s.png align="center")

Built upon request from the APEX community, this feature is really helpful when you have a big number of Dynamic Actions, each having a big number of True/False Actions. Prior to that version, you had to go through each of them to see what they actually do in case you wanted some logic being changed. It happen a lot faster now just naming them and going through the list. And to illustrate that, here is an example of a Dynamic Action with multiple True actions in 22.1 and 22.2:

![The list of True/False actions in APEX 22.2 and prior versions](https://cdn.hashnode.com/res/hashnode/image/upload/v1666883187717/-_LS9qWFK.png align="center")

In addition, each Action is now having its own icon, which makes it even easier to visually recognise the Action Type. Good job, APEX team!

# Number Field

> Support easier number entry on smartphones and tablets with the new Virtual Keyboard attributes.

Just like the `Text Field with Autocomplete` it has some improvements. One of them, adding the `Row CSS Classes` option, other one - adding `inputmode="decimal"` property to the `input` HTML element, so that it automatically displays a numeric keyboard when used on mobile device. 

![Number item](https://cdn.hashnode.com/res/hashnode/image/upload/v1668360060585/8H6WTNwBn.png align="center")

[Louis Moreaux](https://lmoreaux.hashnode.dev/) saw that need and added this recommendation in early September to his blog post on [Improving APEX mobile applications](https://lmoreaux.hashnode.dev/how-to-make-your-mobile-apex-application-look-like-a-native-one-part-2).

# Wider Support for Template Directives

> You can now use Template Directives in HTML Expressions of Classic and Interactive Report columns, enabling you to remove conditional output logic from your SQL queries. 

> 🔗 [Learn more about `Template Directives`](https://docs.oracle.com/en/database/oracle/apex/22.1/htmdb/using-template-directives.html)

> 🔗 Also check [Jon Dixon](https://blog.cloudnueva.com/)'s blog post on [`Template Directives`](https://blog.cloudnueva.com/apex-template-directives).

One of my personal favourites. For a long time, the only options to format Report data with some custom HTML was to do it directly in the select statement or to create a custom Template in Shared Components.

Having the `Template Directives` tackled that and I am using it whenever possible. Here is an example:

![Template Directives](https://cdn.hashnode.com/res/hashnode/image/upload/v1667234672999/Z4emZeVnZ.jpg align="center")

```html
{case SOURCE/}
{when strava/}
<img width="28px" alt="#SOURCE#" title="#SOURCE#" src="#APP_IMAGES#icons/strava_logo_64_64.png">
{when fitness_challenge_app/}
<img width="28px" alt="#SOURCE#" title="#SOURCE#" src="#APP_IMAGES#icons/app_icon_64_64.png">
{otherwise/}
<span>#SOURCE#</span>
{endcase/}
```

What this template does is check the value of my Report `SOURCE` column and applies different HTML based on the value. 

The benefit is that your Report `SQL` query still looks pretty, and at the same time you have the conditional output on your page.

Let's hope `Template Directives` continue to be supported in more and more APEX components! 

# Session State Data Type

### CLOB Support for Page Items
- Now you can store values larger than 32K characters in page items and Interactive Grid columns.

### Session State Data Type
- Items have a new attribute Session State Data Type, available for Textarea, Display Only, Hidden, Rich Text Editor, and Markdown Editor.

### Extended CLOB Support
- Computations, Validations, Source, and Default processes have been extended to support working with CLOBs.

### Bind Variables
- In a PL/SQL process, bind variables will be of the chosen data type. You can also use the new apex_session_state.get_clob('P1_ITEM') API to retrieve the CLOB value.
<hr>

Here is the most important you need to know regarding the use of CLOBs in the new version of APES:
- We now have the capability to save extra-large values in session state - CLOBs
- Until now, submitting a page item longer than 4000 or 32000 characters (depending on your database settings) would result in its truncation and loss of data because `VARCHAR2` data type was used to store the values.
- In 22.2 developers can select between a `VARCHAR2` and `CLOB` datatype. This happens in the new attribute group `Session State` of your item settings 

![Session State attribute group](https://cdn.hashnode.com/res/hashnode/image/upload/v1668361282799/aAnrUrldq.png align="center")

- This new attribute is enabled for `Text Area`, `Display Only`, `Hidden`, `Rich Text Editor`, `Markdown Editor` and `Plugin editor`
- A new public package in the APEX API is now available - `APEX_SESSION_STATE`. It is used for getting and setting Session State values.

🔗 Read the [Official Oracle Documentation](https://docs.oracle.com/en/database/oracle/apex/22.2/aeapi/APEX_SESSION_STATE.html)

# Learn more

🔗 To learn more about the new features, watch the official release videos.
  
%[https://www.youtube.com/watch?v=vPkXKjVHA1s]

%[https://www.youtube.com/watch?v=UfHFqlDTyFo]


# Follow me

> Liked that post? Follow me on Twitter and LinkedIn!

🔷 [@plamen_9](twitter.com/plamen_9) on Twitter <br>
🔷 [Plamen Mushkov](linkedin.com/in/plamen-mushkov/) on LinkedIn

