Solved

Setting Default for date field in form

Posted on 2014-01-26
7
538 Views
Last Modified: 2014-02-06
i have table , HAVING field , Pay_Date
i want to set its default value by choosing from a combo box
1- what is the code of set default value via form
2-how to fill the data of combo box by ending date of all months , e.g :
31-01-2013 , 28-02-2013 , 31-03-2013 .. etc
0
Comment
Question by:NiceMan331
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 500 total points
ID: 39811302
try the below :

Something of the below should help you. try it out, i have not given the exact code so just modify accordingly :

1) if pay_date is a date type field, then use the below

:pay_date := to_date('18/01/2014','dd/mm/yyyy');

if pay_date is a varchar2 type field, then use the below

:pay_date := to_char(sysdate,'dd/mm/yyyy');

2)

this will get you the last_day(trunc(sysdate)) of the current month which is 31-Jan-2014 and after that use add_months(..) in a loop as shown below :

first value for this list should be the resulting value of this : last_day(trunc(sysdate))

x:=2
loop ( x <= 12 ) -- change 12 to whatever number you want
next element of the list := add_months(last_day(trunc(sysdate)),x);
x:=x+1;
end loop;

Thanks,
0
 

Author Comment

by:NiceMan331
ID: 39811330
thanx for explanation
1-the combo box will be on one form , and the field to be update will be on another one
so , pay_date (date format) := (the value of combo box on outside form )
2-what about the years , if now the value is : 31-12-2014 , then add_month will make it : 01-01-2015 ?
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39811354
1. i guess that should work though i do not understand what do you mean by outside form. do you mean another block in the same form or something else ?

2. it depends right, if you run the loop for only 3 or 4 times then the result value will be the end of the months for the next 3 or 4 months only but if you run it for more than that will go on accordingly. If you iterate the loop for 15 or 20 times, then obviously we will get the end of the months of the next year as well right.

Thanks
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:NiceMan331
ID: 39811362
do you mean another block in the same form or something else ?
yes another form
i have form name "startup" form (having the combo box ) , from this form i have a command to open transaction form ( which having pay_date)
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39811417
then i guess you need to use global variables to transfer/access the variables across teh forms. please refer to the forms manual/instruction guide for the use of global variables and then go from there.
0
 

Author Comment

by:NiceMan331
ID: 39811798
i will ,
thanx
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 39840647
Good and Thanks
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question