0
votes

I want to capture file_name and store it in another item field at run time using dynamic action. I tried it to capture File Browser Item field but its capturing entire file path.

Please suggest if this can be done using PLSQL or JS in Oracle Apex 4.2

3

3 Answers

0
votes

You can use regular expression, relying on the fact that there is always a backslash before the filename:

$('#P6_FILE').val().match(/\\([^\\]*)$/)[1]

explaining the regular expression:

  1. \\ double backslash: escaping the backlash
  2. () parenthesis to dig out the filename from the result that initially includes backslashes
  3. [^\\]* any letter that is not a backslash, as many times as you'd like
  4. $ end of string

Stackoverflow sometimes escapes backslashes itself, so this might look messy

0
votes

$('#P6_FILE').val().match(/\([^\]*)$/)[1]

this has worked in DA set value

0
votes

I use this SQL to get the file name from the file browser :

select filename
FROM apex_application_temp_files
where name = :P2_FILE_SELECT;

P2_FILE_SELECT is the file browser item.

Write this SQL into "SQL Query" of SOURCE.