This discussion is archived
8 Replies Latest reply: May 3, 2013 6:49 AM by Joel_C RSS

apex_item help

Irha10 Explorer
Currently Being Moderated
Hi, using apex 4.2.1

i have a page and an item which should display date (pretty easy) but my requirement is field should display only two dates using popup calender today and yesterday so user can select from popup calender and save it in the database.
i came accros about apex_item.date_popup2 or apex_item options but don't know how to use it.

must appricated your help!
  • 1. Re: apex_item help
    Hari_639 Guru
    Currently Being Moderated
    Hello,

    <li> Create Page Item type as "Date Picker"
    <li> Item -> Settings -> Minimum Date -> -1d
    <li> Item -> Settings -> Maximum Date -> +0d

    That't it.

    Regards,
    Hari
  • 2. Re: apex_item help
    Irha10 Explorer
    Currently Being Moderated
    thank you for prompt reply.

    it work but actuall i forgot to wrote my another requirement before. can I use plsql function within field as you mentiioned. basically if yesterday is either('SAT' or 'SUN') than yesderday should be last Friday. I have a function already to calculate it but where and how to use it or any other solultion available?

    many thanks.
  • 3. Re: apex_item help
    fac586 Guru
    Currently Being Moderated
    Irha10 wrote:
    Hi, using apex 4.2.1

    i have a page and an item which should display date (pretty easy) but my requirement is field should display only two dates using popup calender today and yesterday so user can select from popup calender and save it in the database.
    A popup calendar does not sound like the best way to present a choice between only 2 values. You're effectlvely saying to users: "here are 30 options, only 2 are valid, pick one of them". The best UI for selecting between 2 options would be a radio group LOV. If users actually understand the choice as being between "today" and "yesterday" then label the radio buttons as Yesterday (01/05/2013) and Today (02/05/2013). Users then only have to use 1 click after scanning 2 options to make a selection, instead of 1 click to open the calendar, and another to select an option after scanning 30+ possible options.
  • 4. Re: apex_item help
    Irha10 Explorer
    Currently Being Moderated
    I have treid as said but user requirement is popup date calender and min and max work fine but I am just digging how to calculate if yesterday is either 'Sat' or 'Sun' then it should be displayed today and last friday. I have a function (plsql) to calculate it but where and how to use it within item? should i go for validation but DA but requirement still that how to show within popup date calender?

    thanks.
  • 5. Re: apex_item help
    Irha10 Explorer
    Currently Being Moderated
    where should I use this below sql within date item.

    select to_char(sysdate,'dd/mm/yyyy') from dual
    union
    select to_char(my_function(SYSDATE,-1),'dd/mm/yyyy')
    from dual

    my_function is for calculation if yesterday is 'sat' or 'sun' then last friday.

    regards.
  • 6. Re: apex_item help
    Joel_C Pro
    Currently Being Moderated
    Irha10 wrote:
    I have treid as said but user requirement is popup date calender
    Is this honestly the user requirement? Seems somewhat arbitrarily prescriptive. Is the requirement maybe not along the lines of "the user should select a date", rather than "the user should select a date +from a pop up calendar+ "?

    I agree with Paul; by introducing between 26 and 29 "wrong" answers, you are giving the users a lot of scope to make mistakes. I think that, when choosing one option from a list of days of the week, a radio-group is much more useable than a date-picker.
    and min and max work fine but I am just digging how to calculate if yesterday is either 'Sat' or 'Sun' then it should be displayed today and last friday. I have a function >(plsql) to calculate it but where and how to use it within item? should i go for validation but DA but requirement still that how to show within popup date calender?
    Again, much easier with a radio-group. Put the following code into the LOV definition for the page item (or a refinement of it - this was off the top of my head):
    select 'TODAY' d
           , sysdate r 
      from dual
     union all
    select 'PREV WORKING DAY' d
           ,case to_char(sysdate-1,'DAY')
            when 'SATURDAY' then sysdate-2
            when 'SUNDAY' then sysdate-3
            else sysdate-1 end r
      from dual
  • 7. Re: apex_item help
    Irha10 Explorer
    Currently Being Moderated
    thnaks for help.
    I have managed bit. I created two items. one hidden and source come from my function which is last day and then use this item in other item setting in minumum date as &P10_X1. it does work but it still enable all the previous date from today but not forward date. good thing it validate before updating into the table as if user select some date (not yesterday or today) then get an error. I am still working on it but so far good.

    Regards.
  • 8. Re: apex_item help
    Joel_C Pro
    Currently Being Moderated
    Irha10 wrote:
    thnaks for help.
    I have managed bit. I created two items...I am still working on it but so far good.
    You are just making a rod for your own back - this will come back to haunt you methinks...If you are only allowing the user to choose one of two dates, why on earth do you need a date picker?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points