Skip to main content


Showing posts from March, 2022

Copy cell value from IG (global edition)

T There is an article (more like a reply from grid master John Snyders) about how to enable cell copy from interactive grid . It has some limitations, at least for my use case. Some grids don't have static_id, it ignore some cells (with HTML code) and I want all grids behave the same without putting anything into the JavaScript initialization block. I have spent too much time researching how to do that properly and then I wrote this code. Just put it to onload event in your app, no need to adjust individual pages or grids. document.addEventListener('copy', (event) => { event.clipboardData.setData('text/plain', $(document.activeElement)[0].innerText || window.getSelection()); event.preventDefault(); }); When you select a cell in a grid and copy it to clipboard, the text value from selected cell will be copied no matter the cell type (read only, display only, link...). You can still do partial text selections on input fields. And you can/will copy

Ping/notify user on event

I I had to switch to using materialized view for my custom navigation because quering dictionaries on free cloud tends to be too slow. So now I have a button Publish changes to refresh this MVW and it takes some time. I don't want to keep user waiting while this is done, so I refresh it via background job. Which brings a problem. How to inform user about the result of the background job? Websockets for poor. I created application process AJAX_PING and call it in Javascript each 6 seconds. This lightweight process just checks content of user_messages table which is filled through app_actions.send_message procedure . So user click on the Publish button, which triggers DA, which starts background job for MVW refresh, disable the button and show user a message confirming start of the operation. User can wait on the page or freely move through the application. 20 seconds later procrastinating on a different page a result arrive: I think this is a very user friendly way

DeepL integration (auto translate)

A A friend of mine told me he use DeepL translation service for his translations. So naturally I implemented it into my app. Here is how I did it. You have to create account on DeepL , free account is enough, at least for me. Then you need to get your auth key and use it in code below. FUNCTION get_live_translation ( in_text VARCHAR2, in_lang VARCHAR2 ) RETURN VARCHAR2 AS l_secret CONSTANT VARCHAR2(64) := 'YOUR_AUTH_KEY'; -- r VARCHAR2(4000); BEGIN r := APEX_WEB_SERVICE.MAKE_REST_REQUEST ( p_url => '' || l_secret || '&' || 'text=' || UTL_URL.ESCAPE(in_text) || '&' || 'target_lang=' || in_lang || '&' || 'source_lang=' || 'EN',

Multilingual APEX app using page items

Y You probably know the official way how to translate APEX apps . You most likely also know ho to translate APEX itself or how to add unsupported languages . For me, translating my apps the official way is too slow and complicated. I often have requirements to translate just the most important things in the app, so people without english knowledge can get around. There is no need to translate every bit. Which is ideal for utilizing APEX items. Alternative Lets explore this alternative. The main idea is to use APEX items instead of texts and translate these items based on user preference (or browser language when preference is missing). The main issue with this approach is the time needed to create and maintain these items. And also the item clutter madness and minimal item reusability. Who likes to have tens to hundreds items on page? Check the source for this translated page, you should notice that I don't use item prefixes (for translation items to make code r