20230305 - 파일 업로드 to 테이블 BLOB 컬럼

테이블 생성, Quick SQL에서 file 타입으로 입력하면 자동으로 blob, _filename, _mimetype, _charset, _lastupd 컬럼이 생성됨



create table x230303_file (
    fid                            number generated by default on null as identity
                                   constraint x230303_file_fid_pk primary key,
    upload                         blob,
    upload_filename                varchar2(512 char),
    upload_mimetype                varchar2(512 char),
    upload_charset                 varchar2(512 char),
    upload_lastupd                 date
)
;

-- load data
 
-- Generated by Quick SQL Friday March 03, 2023  14:51:02
 
/*
x230303_file
  fid /pk
  upload file

# settings = { semantics: "CHAR", language: "EN", APEX: true }
*/


폼 페이지, 폼 리전 생성


P172_UPLOAD 항목 설정

Identification - Type : File Browse...

Setting - Display As : Block Dropzone

Storage Type : BLOB column specified in Item Source attribute

MIME Type Column : UPLOAD_MIMETYPE

Filename Column : UPLOAD_FILENAME

Character Set Column : UPLOAD_CHARSET

BLOB Last Updated Column : UPLOAD_LASTUPD



P172_UPLOAD Submit 될 때 체크할 Validation

Identification - Name : P172_UPLOAD_VAL

Validation - Type : Item is NOT NULL

Item : P172_UPLOAD

Error - Error Message : 업로드할 파일을 선택하십시오.

Display Location : Inline with Field and in Notification

Associated Item : P172_UPLOAD

Server-side Condition - When Button Pressed : CREATE

Type : Item is NULL

Item : P172_FID



파일 업로드 프로세싱과 Close Dialog







참고

Gallery - Sample File Upload and Download



https://forums.oracle.com/ords/apexds/post/how-to-upload-a-clob-into-a-table-9792

https://doyensys.com/blogs/25447-2/

https://arrayofpointers.wordpress.com/2015/01/11/upload-and-view-a-file-imagepdfdoc-in-a-list-of-oracle-apex-page/


http://jsfiddle.net/dirtyd77/LzLcZ/144/

  • Add an unconditional page rendering page process
  • Choose "Data Manipulation" and click "Next"
  • Select the default, "Automated Row Fetch", then click "Next"
  • Give the process a name, "Fetch Row from EBA_DEMO_FILES" (for example), change the processing point to "On load - After Header" and click "Next"
  • Enter the table name of the application's "files" table, the APEX page item id of the page item that references the file being uploaded, and the column name of the blob column in the afore assigned application "files" table and click "Next"
  • Optionally add a success and/or error message, click "Create Process"
  • Create an "HTML" region (for holding your file upload form element)
  • Create a hidden page item that will hold the primary key id value of the row that holds the file (e.g, P12_ID)*
  • Now create a "File Browse" page item in the same region as the above page items, ensure the "Storage Type" value is set to "BLOB column specified in Item Source attribute"
  • Define the application tables' column names for holding, MIME Type, Filename, Character Set, and BLOB Last Updated, and then click, "Next"
  • Then click, "Create Item"*
  • Create the other hidden page items that will store the filename, mimetype, and character set meta data*
  • If your application's files table has a description (or comments) column, add a textarea page item for capturing this information*
  • Now create an unconditional page processing process
  • Choose "Data Manipulation" and click "Next"
  • Give the process a name, "Process Row from EBA_DEMO_FILES" (for example), change the processing point to "On Submit - After Computations and Validations" and click "Next"
  • Enter the table name of the application's "files" table, the APEX page item id of the page item that references the file being uploaded, and the column name of the blob column in the application's "files" table and then click "Create Item"
  • Create the Cancel, Delete, Apply Changes, and Create buttons (see implementation of buttons on this page)
  • Now create a conditional page processing process
  • Choose "Session State" and click "Next"
  • Select "Clear Cache for all Items on Pages (PageID,PageID,PageID)" and click "Next"
  • Give it a name of "reset page", leave the other defaulted values, click "Next"
  • Enter the current page id and then click "Next"
  • Optionally add Success and/or Error Messages and then click "Next"
  • Change the "When Button Pressed" condition to use the "Delete" button, leave all other options set to their default values and click "Create Process"

* Be sure to set the identified page item's "Source Type" as "Database Column" and assign their "Source value or expression" as the corresponding column name in the application's "files" table.

20230227 - 사용자 접속 디바이스 정보 확인

Region - Type : Dynamic Content

Source - Language - PL/SQL



begin
  owa_util.print_cgi_env();
end;




select * from APEX_ACTIVITY_LOG




참고

https://forums.oracle.com/ords/apexds/post/display-user-agent-on-page-8638

 http://www.grassroots-oracle.com/2012/11/categorizr-for-apex-extended.html



--==============================================================================
-- Returns TRUE if the current page has been designed for Desktop browsers.
--==============================================================================
function is_desktop_ui return boolean;
--
--==============================================================================
-- Returns TRUE if the current page has been designed for smartphone devices
-- using jQuery Mobile.
--==============================================================================
function is_jqm_smartphone_ui return boolean;
--
--==============================================================================
-- Returns TRUE if the current page has been designed for tablet devices
-- using jQuery Mobile.
--==============================================================================
function is_jqm_tablet_ui return boolean;
--
--==============================================================================
-- Returns the UI type for which the current page has been designed for.
--==============================================================================
function get_ui_type return varchar2;

20230227 - SQL : REGEXP_LIKE 과 TABLE(APEX_STRING.SPLIT('부산|광주|충청||', '|')

조회 조건에 주소1, 주소2 ... 주소5가 있는 상황에 각 주소를 입력하게되면 OR 조건으로 해당 데이터를 가져올 수 있도록 SQL 구현.


처음에는 Oracle Text의 contains 를 활용하여 구현하였으나 한글에 대한 것은 지원이 잘 안 되는 부분들이 확인되어 정규 표현식으로 대체 구현하게 됨.

데이터가 분명히 존재함에도 '충청북도', '충청남도'로는 조회되지 않음


AS-IS


   and (decode(nvl2(:P302_ADDR1,1,0)+nvl2(:P302_ADDR2,1,0)+nvl2(:P302_ADDR3,1,0)+nvl2(:P302_ADDR4,1,0)+nvl2(:P302_ADDR5,1,0), 0, '%') = '%'
        or contains(pomst.cust_addr, '%'||:P302_ADDR1||'%|%'||:P302_ADDR2||'%|%'||:P302_ADDR3||'%|%'||:P302_ADDR4||'%|%'||:P302_ADDR5||'%') > 0)


TO-BE

 
   and REGEXP_LIKE(pomst.cust_addr, nvl((select listagg(column_value, '|') from table(apex_string.split('부산|광주|충청||', '|')
                                                                                     )
                                        ), '|')
                  )



20230218 - UX 컨텐츠 블럭 Contents Block

리전이 여러 개여도 하나의 컨텐츠처럼 보임.



1. About

Static Contents - HTML code

Appearance - Template : Contents Block

Template Options : 


2. Features

Classic Report 


select
  1 id,
  'Faster Performance' list_title,
  'Take advantage of advanced caching for even faster page rendering performance.' list_text,
  null list_class,
  null link,
  null link_attr,
  null icon_color_class,
  'fa fa-bolt' icon_class
from sys.dual
union all
select
  2 id,
  'Install on Mobile or Desktop' list_title,
  'Your app can be installed on any desktop or mobile devices without downloading from an app store.' list_text,
  null list_class,
  null link,
  null link_attr,
  null icon_color_class,
  'fa fa-cloud-arrow-down' icon_class
from sys.dual
......


Appearance - Template : Contents Block

Template Options : 


CSS Classes : col-lg-10 col-xl-8 col-xxl-8


3. Explore

List, Navigation Menu

Layout - Column CSS Classes : col-lg-10 col-xl-8 col-xxl-8

Appearance - Template : Contents Block

Template Options : 





20230212 - IG 수정 모드 제어를 위한 IG 버튼 보이기/감추기

마스터 대표상품 YN에 따라서 하위구성 IG의 버튼을 보이고 감추는 DA

SelectionChange



if (this.data == null || this.data.selectedRecords[0] == null) return;

if(this.data.model.getValue(this.data.selectedRecords[0], "REP_YN") == "Y") {
  var vActions = apex.region("SID_IGPDTL").widget().interactiveGrid("getActions");
  vActions.show("edit");
  vActions.show("selection-add-row");
  vActions.show("save");
  vActions.show("change-view");
}
else {
  var vActions = apex.region("SID_IGPDTL").widget().interactiveGrid("getActions");
  vActions.hide("edit");
  vActions.hide("selection-add-row");
  vActions.hide("save");
  vActions.hide("change-view");
}




참고

https://forums.oracle.com/ords/apexds/post/dynamically-set-options-on-an-interactive-grid-1813

https://docs.oracle.com/en/database/oracle/apex/22.2/aexjs/interactiveGrid.html#event:selectionchange


20230212 - Validation 검증

IG 저장 전 해당 입력 값에 대한 검증 진행


(:rep_yn = 'N') or
(:rep_yn = 'Y' and (select count(*) from prod_dtlx where dtl_pid = :prod_id) = 0)


Example


SQL Expression
( :JOB = 'SALESMAN' and :COMM is not null ) or ( :JOB != 'SALESMAN' and :COMM is null )

Error message
#COLUMN_HEADER# must have a value only when Job is Salesman.








20250315 - 글로벌 변수 Global Variables

G_USER Specifies the currently logged in user. G_FLOW_ID Specifies the ID of the currently running application. G_FLOW_STEP_ID Specifi...