Home » Developer & Programmer » Forms » Form help (10.1.0.4.2)
Form help [message #538610] Sat, 07 January 2012 10:52 Go to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
I think this is to do with more pl/sql than forms so sorry if wrong part of forums. Basically i have a form with data and 2 blank text boxes and a button. The one text box is date from and the other is date to, when the button is pressed I only want the data to be showing between the 2 entered dates. I know the code for sql but not sure for pl/sql and in forms. The names of the text boxes are dateFrom and dateTo. the sql statement -

select * from workload where date_of_meeting between 

to_date('24/03/2011','DD-MM-YYYY') and to_date

('22/04/2012', 'DD-MM-YYYY');

[Updated on: Sat, 07 January 2012 10:54]

Report message to a moderator

Re: Form help [message #538612 is a reply to message #538610] Sat, 07 January 2012 11:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68666
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I only want the data to be showing between the 2 entered dates.


In which form/unit?
The (direct) difference between 2 dates is in unit of days.

Regards
Michel
Re: Form help [message #538613 is a reply to message #538612] Sat, 07 January 2012 11:06 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
the units of the text boxes will be written as dd-mm-yyyy. So its just the differences between 2 dates. I also forgot to mention I need to enable the 2 text boxes as a database item. Im a programmer in c# but new to pl/sql

so something like
dateto.databaseitem = true; 

did not work lol
Re: Form help [message #538615 is a reply to message #538613] Sat, 07 January 2012 11:34 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
What data do you want restricted? Your question is less than clear.
Re: Form help [message #538616 is a reply to message #538615] Sat, 07 January 2012 11:38 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
I have a form with data on it, but I want to restrict this data by using 2 extra text boxes created on the form. The one text box is dateto and the other text box is date from. I want only the data to be displayed in between these 2 dates. The data on the form has a column called date_of_meeting and this is what I where the text boxes will filter. I was wondering how to do this with a click of a button, I have shown what i want in the sql statement above its just in the forms i am unsure about

thanks

[Updated on: Sat, 07 January 2012 11:40]

Report message to a moderator

Re: Form help [message #538617 is a reply to message #538616] Sat, 07 January 2012 11:42 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's how I understood it: create a control block (i.e. the one that is not based on a table). Create two items in that control block: DATE_FROM and DATE_TO (both DATE datatype). Also, create a button.

Now create another block - this time, a data block (i.e. based on a table from which you want to display records whose date column's values are between DATE_FROM and DATE_TO).

Now, create a WHEN-BUTTON-PRESSED trigger on control block's push button:
set_block_property('second_block', onetime_where, 'date_column between :date_from and :date_to');
go_block('second_block');
execute_query;

That should do it.
Re: Form help [message #538619 is a reply to message #538617] Sat, 07 January 2012 12:01 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
Is it not possible to filter the data from the 2 text boxes on the same form as the data. Maybe an image will explain my needs easier
  • Attachment: Form.jpg
    (Size: 72.08KB, Downloaded 648 times)
Re: Form help [message #538621 is a reply to message #538619] Sat, 07 January 2012 12:16 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Technically speaking, if your users *know* how to use Forms built-in querying capabilities, you don't need none of DATE_FROM, DATE_TO and FILTER button. You'd enter query mode, enter :a into the DATE_OF_MEETING (if I read it well) item, push execute_query; a window will open. Enter
:a between to_date('24.03.2011', 'dd.mm.yyyy') and to_date('28.11.2011', 'dd.mm.yyyy')
in there and push ... ummm, "Search" I think (not 100% sure, but you'll figure it out yourself).

Apparently, DATE_FROM and DATE_TO are not database items. You can leave them in current (database) block. However, why do you care where they are? It is kind of "best practices" to put such an items into a separate, control block. If you don't want to, go ahead.
Re: Form help [message #538638 is a reply to message #538621] Sat, 07 January 2012 17:15 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
Yer I understand that, I was just trying to make it more user friendly, ill probably end up just letting them write the query like you said, thanks for your help
Re: Form help [message #538643 is a reply to message #538638] Sun, 08 January 2012 00:42 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Although it is the way to do that, making people know such a syntax is less than user-friendly. Maybe your users are capable of remembering TO_DATE syntax and stuff; majority of my users would find that annoying.

What's wrong with a really user-friendly suggestion described in a message #538617?
Re: Form help [message #538655 is a reply to message #538643] Sun, 08 January 2012 05:16 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
Ok so how would I go about making it work in a sepaerate control block? Sorry I'm new to oracle forms
Re: Form help [message #538660 is a reply to message #538655] Sun, 08 January 2012 06:22 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Littlefoot explained it above with sample code.
Re: Form help [message #538762 is a reply to message #538660] Mon, 09 January 2012 06:10 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
Ive done what u guys said am im getting - FRM-40105 - Unable to resolve reference to item date_from
Re: Form help [message #538766 is a reply to message #538762] Mon, 09 January 2012 06:23 Go to previous messageGo to next message
cookiemonster
Messages: 13926
Registered: September 2008
Location: Rainy Manchester
Senior Member
Then you did something wrong.
What exact code did you use where?
Re: Form help [message #538771 is a reply to message #538766] Mon, 09 January 2012 06:31 Go to previous messageGo to next message
winnitbaker
Messages: 20
Registered: January 2012
Junior Member
I created a control block on the same canvas as my data block, the control block has 2 text box items set as date. One date_from one date_to, the data block has fields related to the table one called date_of_meeting, the schedule of meeting is the data block. The code is behind the when button pressed trigger. Below is the code -
set_block_property('SCHEDULE_OF_WORKLOAD', onetime_where, 'date_of_meeting between :date_from and :date_to');
go_block('SCHEDULE_OF_WORKLOAD');
execute_query;

[Updated on: Mon, 09 January 2012 06:31]

Report message to a moderator

Re: Form help [message #538837 is a reply to message #538771] Mon, 09 January 2012 11:55 Go to previous message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK; what does your last message mean? Did you make it work, finally?
Previous Topic: form dependent on another form...
Next Topic: List forms global variables at runtime
Goto Forum:
  


Current Time: Tue Jul 09 21:50:41 CDT 2024