Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » LOV for time (Application Express, 4.0, windows 7)
LOV for time [message #534312] Mon, 05 December 2011 04:27 Go to next message
abarnybox
Messages: 49
Registered: November 2011
Member
Hi,

What I would like to do is to have a select list for times that visits are allowed. Which is from 06:00 to 23:00 every 30 minutes 06:00, 06:30, 07:00...etc.
Thing is I don't want to have to type all the times, is there a way to have and hour select list and a minute select list but return them both to the Time column?
(I have to have the same thing from 00:00 to 23:55 every 5 minutes in another section...so I reeeeally don't want to type all them out Razz)

Is a select list and a LOV the best way to do this even? I did look at the date picker...but I couldn't get it to select just time or to select every 30 mins or whatever...

thanks

abarnybox
Re: LOV for time [message #534344 is a reply to message #534312] Mon, 05 December 2011 07:35 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
A simple row generator is what you are looking for. Here's an example of the first part of the question; I'll let you develop the second one.

I have displayed character values - you might need to convert them to DATE ones, if necessary (simply remove TO_CHAR function).

SQL> select to_char(trunc(sysdate) + level / 2 /24, 'hh24:mi') res
  2  from dual
  3  connect by level < 48;

RES
-----
00:30
01:00
01:30
02:00
02:30

<snip>

21:00
21:30
22:00
22:30
23:00
23:30

47 rows selected.

SQL>
Re: LOV for time [message #534346 is a reply to message #534344] Mon, 05 December 2011 07:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Nothing happen at midnight? Or are you scare of what could happen? Laughing

Regards
Michel
Re: LOV for time [message #534348 is a reply to message #534346] Mon, 05 December 2011 07:50 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Vampires walk around; I don't want to mess with them (no more garlic).
Re: LOV for time [message #534349 is a reply to message #534348] Mon, 05 December 2011 07:57 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
Hi,
Thanks a lot just where do I put that? in the LOV bit?
Re: LOV for time [message #534378 is a reply to message #534349] Mon, 05 December 2011 13:05 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Create a LoV in Shared Components and use it when needed.
Re: LOV for time [message #534470 is a reply to message #534378] Tue, 06 December 2011 06:46 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
It doesn't seem to be working...:/
I've tried taking out the to_char but it doesn't make a difference.

I've taken out the 2 and 3 and the 2 'SQL>'s, but other than that its copy pasted
Re: LOV for time [message #534472 is a reply to message #534470] Tue, 06 December 2011 07:58 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
"Not working" is less than descriptive.

What exactly did you do? Was there any error message? If so, which one? What are table columns' datatypes, what datatypes did you use in Apex? Provide as many details as possible, because it is difficult to debug a "not working" problem.
Re: LOV for time [message #534473 is a reply to message #534472] Tue, 06 December 2011 08:30 Go to previous messageGo to next message
abarnybox
Messages: 49
Registered: November 2011
Member
haha sorry,

Turns out we're just going to merge the 'time' and 'date' columns now anyway so a datepicker works fine for now, incase you still want to know though my story is thus:
I copied from select to the fullstop, went into shared components, LOV, Create then I selected Dynamic from the wizard and pasted that in the box there.
Yes there was an error: LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
so I tried again removing the 2 and 3: no change, tried again removing the whole to_char function: no change, tried again removing various different bits and no change for any of them.

but as I say it doesn't matter anymore, thanks anyway

abarnybox
Re: LOV for time [message #534494 is a reply to message #534473] Tue, 06 December 2011 10:39 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I see ... so it is you who doesn't read the manual and wonders how come your query becomes invalid.

LoV SELECT statement requires two values: "display" and "return" one. There's an example at the bottom of the LoV wizard (gray letters, if I remember well), so take a look - it describes how a static LoV looks like, and how a dynamic one looks like. You'll probably get the idea when you see it. Shortly, a query should look like
select employee_name display_value, employee_id return_value
from some_table
where ...
Previous Topic: ORA-06550: line 1, column 43: PL/SQL: ORA-00928: missing SELECT keyword
Next Topic: Wizard apex file upload Load only distinct values
Goto Forum:
  


Current Time: Fri Mar 29 03:39:57 CDT 2024