Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Apex Tutorial Sample doesn't seem to produce expected results

PhilMan2Aug 11 2021 — edited Aug 12 2021

Hello,
I'm using Apex 19 on an 18.C database. I followed a tutorial https://docs.oracle.com/en/database/oracle/application-express/18/tutorial-mobile-app-create/ . It is a good tutorial but a few things didn't seem to work correctly. I was wondering if I was doing something wrong. It was the third tutorial (Improving Navigation https://docs.oracle.com/en/database/oracle/application-express/18/tutorial-mobile-app-improve-navigation/#BeforeYouBegin) that seemed to give me trouble. I found two issues:

  1. Minor issue. The SQL for the List View on the Home Page seemed to be wrong. It referenced pages 4, 8 and 10 but the directions in the modules 1 and 2 seem to create pages 10, 13 and 16. The corrected SQL (I updated script.txt) seems to enable the List View to navigate to the correct page:
    select 'Open Projects' as label,
    count(*) as value,
    'f?p='||:APP_ID||':10:'||:APP_SESSION||':::' as url
    from sample$projects
    where completed_date is not null
    union all
    select 'Upcoming Milestones' as label,
    count(*) as value,
    'f?p='||:APP_ID||':13:'||:APP_SESSION||':::' as url
    from sample$project_milestones
    where due_date > sysdate
    union all
    select
    'Incomplete Tasks' as label,
    count(*) as value,
    'f?p='||:APP_ID||':16:'||:APP_SESSION||':::240' as url
    from sample$project_tasks
    where nvl(is_complete_yn, 'N') = 'Y'
  2. The second problem is a little more tricky to me. The WHERE clauses in that same SQL doesn't seem to actually filter any data. When I arrive at the three individual reports, I see ALL data, as though the three WHERE clauses were not there. When I run an individual SELECT statement in SQL Developer, it filters the data as expected. It doesn't seem to work inside the Mobile App. Is there something special I have to do to enable the WHERE clauses?
  3. The count(*) as value function doesn't produce a count for the List View.
    Thanks for checking.
    Phil

Comments

LA County APEX

You can use a JavaScript to accomplish that. Check my application

Workspace: ladevapex

User Name: mydevfellow

Password: Pa$$word1

To test the application, follow the steps below:

  • Click Upload New Image button
  • Click Detail button
  • Enter or select the first row objects.
J.col

Hello.

Thanks for the answer and the application infos. I took a look and I learnt a lot of things !

For my issue, I checked your page 7 (detail button) and I didn't understand how it works. I think what I'm doing is very similar to your page 7, but I'm probably missing something.

Here is a part of my application.

pastedImage_0.png

When the user selects a date or a "New" value I want to update my right part with the selected info

pastedImage_1.png

For the moment, I created a PL/SQL process I duplicated in every concerned field.

As this is only a demo application with 4/5 fields, this is not a problem. But at the end, I'll have more than 30 distinct selection fields, and I cannot duplicate my PL/SQL process 30 times ^^

Can you explain me how you would do that please ?

Best regards.

LA County APEX
Answer

All you have to do is to call a JavaScript function to collect value from each item into your display list. Note, this is only to display to the user what being selected. When saving the record, you need to pass the actual value from each item to your process as a parameter.

The following example is the function on page 7 of my application.

function shwVal()

{

  $x('SELVAL').innerHTML = '';

  if ($x('P7_TXT1').value != '')

        $x('SELVAL').innerHTML = $x('P7_TXT1').value;

  var comm = '';

  if ($x('SELVAL').innerHTML)

       comm = ',';

   if ($x('P7_TXT2').value.length == 4)

        $x('SELVAL').innerHTML = $x('SELVAL').innerHTML + comm + $x('P7_TXT2').value;

    if ($x('SELVAL').innerHTML)

       comm = ',';

    $x('SELVAL').innerHTML = $x('SELVAL').innerHTML + comm + apex.item('P7_SEL').getValue();

    if ($f_SelectValue('P7_CHKBX') != '')

        $x('SELVAL').innerHTML = $x('SELVAL').innerHTML + comm + $f_SelectValue('P7_CHKBX');

    if ($x('SELVAL').innerHTML)

       comm = ',';

    if ($f_SelectValue('P7_RADIO') != '')

        $x('SELVAL').innerHTML = $x('SELVAL').innerHTML + comm + $f_SelectValue('P7_RADIO');

}

Marked as Answer by J.col · Sep 27 2020
J.col

Hello !

I'm not familiar with Javascript and its integration into Apex so I didn't look at the good place.

With the search function, I was able to find your JS function and how you call it into your items.

A big thanks !

1 - 4

Post Details

Added on Aug 11 2021
1 comment
179 views