Auto-Incrementing Date Field
In my report I have information on parts that have been ordered. I have the part number, date ordered, quantity ordered, date received, among others. What I want to do is insert a custom field that gives me each day that had transpired beteen the Date Ordered and the Date Received. I want one row for each intervening date, including the Date Ordered and the Date Received. How can I do that?
Hi,
I am not sure if you can get a dates between ordered date and received date. However you can get it as a comma separated list as a field.
Try following formula
numberVar d:= DateDiff ("d",{ABC.DT_ORD},{ABC.DT_RECEIVED} );
numberVar i;
StringVar abc;
StringVar inDate;
for i:=1 to d do
abc:=totext({ABC.DT_ORD} + d);
inDate:=inDate & abc & ",";
inDate;
--Kuldeep
Similar Messages
-
Is there a auto-increment data type in Oracle
Is there a auto-increment data type in Oracle ?
How to do it if there is no auto-increment data type in Oracle ?
nulljackie (guest) wrote:
: Is there a auto-increment data type in Oracle ?
: How to do it if there is no auto-increment data type in Oracle
Hi,
I think you need unique ID's, for this purpose you use sequences
in Oracle. Example:
create table xy (
id number,
name varchar2(100)
alter table xy
add constraint xy_pk primary key(id);
create sequence xy_seq start with 1 maxvalue 99999999999;
(there are many other options for create sequence)
create or replace trigger xy_ins_trg
before insert on xy
for each row
begin
select xy_seq.nextval
into :new.id
from dual;
end;
This produces a unique value for the column id at each insert.
Hope this will help.
peter
null -
I have a JavaScript that I use to auto populate date fields. However, I've discovered that it doesn't work when the form is opened on an iPhone or Android phone. Is there a way to auto-populate a date field without using JavaScript?
What app on the iPad are you using.
Different apps on mobile devices have varying degrees of JavaScript compatibility. -
Utilizing auto-increment/identity fields for primary key with "application" identity
Is it possible to utilise an auto-increment (identity in MS SQL Server)
field for the primary key field when using "application" identity?To the best of my knowledge, you cannot use auto-increment. Due to the
differences in the way that identities are generated at the datastore
(upon insert) vs. JDO (upon makePersistent), this feature of SQLServer is
not supported yet.
However, we do provide a variety of other ways of generating identity
which may provide a closer fit to what you want, and
our users may have some experience in solving your problem.
On Tue, 28 Jan 2003 09:56:08 +0000, Sean Ryan wrote:
Is it possible to utilise an auto-increment (identity in MS SQL Server)
field for the primary key field when using "application" identity?--
Stephen Kim
[email protected]
SolarMetric, Inc.
http://www.solarmetric.com -
Auto Increment ID Field Table in the Oracle Database (insert new record)
I have been using the MySQL. And the ID field of the database table is AUTO INCREMENT. When I insert a new record into a database table, I can have a statement like:
public void createThread( String receiver, String sender, String title,
String lastPostMemberName, String threadTopic,
String threadBody, Timestamp threadCreationDate,
Timestamp threadLastPostDate, int threadType,
int threadOption, int threadStatus, int threadViewCount,
int threadReplyCount, int threadDuration )
throws MessageDAOSysExceptionand I do not have to put the ID variable in the above method. The table will give the new record an ID number that is equivalent to the ID number of the last record plus one automatically.
Now, I am inserting a new record into an Oracle database table. I am told that I cannot do what I am used to doing with the MySQL database.
How do I revise the createThread method while I have no idea about what the next sequence number shall be?I am still very confused; in particular, the Java part. Let me try again.
// This part is for the database table creation
-- Component primary key sequence
CREATE SEQUENCE dhsinfo_page_content_seq
START WITH 0;
-- Trigger for updating the Component primary key
CREATE OR REPLACE TRIGGER DHSInfoPageContent_INSERT_TRIGGER
BEFORE INSERT ON DHSInfoPageContent //DHSInfoPageContent is the table name
FOR EACH ROW WHEN (new.ID IS NULL) // ID is the column name for auto increment
BEGIN
SELECT dhsinfo_page_content_seq.Nextval
INTO :ID
FROM DUAL;
END;/I am uncertain what to do with my Java code. (I have been working with the MySQL. Changing to the Oracle makes me very confused.
public void updateContent( int groupID, String pageName, int componentID,
String content, Timestamp contentCreationDate )
throws contentDAOSysException
// The above Java statement does not have a value to insert into the ID column
// in the DHSInfoPageContent table
Connection conn = null;
PreparedStatement stmt = null;
// what to do with the INSERT INTO below. Note the paramether ID.
String insertSQL = "INSERT INTO DHSInfoPageContent( ID, GroupID, Name, ComponentID, Content, CreationDate ) VALUES (?, ?, ?, ?, ?, ?)";
try
conn = DBConnection.getDBConnection();
stmt = conn.prepareStatement( insertSQL );
stmt.setInt( 1, id ); // Is this Java statement redundant?
stmt.setInt( 2, groupID );
stmt.setString( 3, pageName );
stmt.setInt( 4, componentID );
stmt.setString( 5, content );
stmt.setTimestamp( 6, contentCreationDate );
stmt.executeUpdate();
catch
finally -
Incrementing Date field in Variable based on a specific calendar
Hello All,
I am currently setting up a schedule that includes Mass activities. I am running into a problem when i want a particular date field an activity to increment by one day based on a specific calendar i.e. Factory calendar (M-F open).
EX)
The due date field for on any given day the mass activity runs should be system date plus 2 business days.
While the posting date field on the same transaction should increment by 2 day.
Result would be:
On System date = 02/17/11
Due Date Field = 02/21/11
Posting Date = 02/19/11
I am currently using expression similiar to this: =Time.expression(Time.now('GMT'), 'add 2 days') but cannot find documentation how to include calendars in this as you would with =Time.isTimeWindowOpen(Time.now('GMT'), 'Factory Calendar').
Can someone please point me in right direction?
Thanks
DanHi Gerben,
I tried this and it yielded unacceptable(expected) results. Here is why i think this is the case.
=Time.expression(Time.nextTimeWindowOpening(Time.now('America/Regina'), 'System_Week_WorkDays'), 'add 7 days') suppose to only be open m-f
Time.now() should evaluate to today lets say 02/21/11
then Time.nextTimeWindowOpening should return the next open day, after but including today, it checks and finds today is open so = 02/21/11
and the time expression will add n= 7 days to that. 02/21/11 + 7 = 02/28/11 this is wrong.
According to this calendar it should be 03/01/11
Problem is that the add function is just adding n days indiscriminate of the calendar as the calendar is not part of the addition argument.
Edited by: Daniel Austin on Feb 21, 2011 9:31 PM -
Hello,
I would like to have a number field to be auto increment. Ho can I do that in Oracle must I use some code for it or can I make the field auto increment by itself.
Thanksuser3311314 wrote:
Hello,
I would like to have a number field to be auto increment. Ho can I do that in Oracle must I use some code for it or can I make the field auto increment by itself.
ThanksIt's a long standing gripe of mine. You must use code, and the appropriate solution is a sequence and a trigger, eg
SASH_CLIENT @ DB10G >create table t(
2 id number not null primary key
3 , c1 char(100));
Table created.
SASH_CLIENT @ DB10G >
SASH_CLIENT @ DB10G >create sequence seq_t;
Sequence created
SASH_CLIENT @ DB10G >
SASH_CLIENT @ DB10G >create or replace trigger bir_t
2 before insert on t
3 for each row
4 begin
5 select seq_t.nextval into :new.id from dual;
6 end;
7 /
Trigger created.
SASH_CLIENT @ DB10G >insert into t(c1) values ('row 1');
1 row created.
SASH_CLIENT @ DB10G >commit;
Commit complete.
SASH_CLIENT @ DB10G >select * from t;
ID C1
1 row 1I'd much prefer
create table t (
id number primary key default seq_t.nextval
, c1 char(100)); -
LiveCycle ES2 - Auto Populate Date field when signed
Good afternoon,
I've got a signature field called "sgnPOC" and a date field called "sgnPOCDate" I'd like to have the date field filled in automatically when the sgnPOC is digitally signed.
I added the following to the postSign* event to sgnPOC.
FORM.Main.sgnPOCDate.rawValue = util.printd("mm/dd/yyyy", new Date());
and different variations including setting the date to yyyymmdd and like. It just won't auto populate. It passes the script check in the script editor.
any ideas?
Thank you.Thank you,
I tried the following - to no success.
FORM.Main.sgnPOC::postSign - (JavaScript, client)
var myDate=date()
FORM.Main.sgnPOCDate.rawValue = Num2Date(myDate, "YYYY-MM-DD")
I also tried this
FORM.Main.sgnPOC::postSign - (JavaScript, client)
var myDate=date()
$.rawValue = Num2Date(myDate, "YYYY-MM-DD")
Which also did not work, but wouldn't that need to know where to put the date? -
Forms 11g auto-complete date field
Hi,
In forms60 we had a few registry keys that made it possible for the end user to type in parts of a date and have it auto-completed.
Example :
The user wants to type in 20/10/2010 but merely had to type in 20<ENTER>
This worked in forms60, is there a way to achieve this in forms 11g?
Thank you
PS: I have already tried
NLS_DATE_FORMAT=DD/MM/YYYY
FORMS_OUTPUT_DATE_FORMAT=DD/MM/YYYY
FORMS_USER_DATE_FORMAT=DD/MM/YYYY
In default.env with no luck.Dear Christian, yes I am certain.
I just investigated it a little more and it appears it all depends on the following registry keys :
HKLM\Software\Oracle\forms60_user_date_format which has value : ddmmyyyy|ddmm|dd|dd/mm/yy|ddmmyy|dd/mm|dd/mm/yyyy
HKLM\Software\Oracle\forms60_user_datetime_format which has value : ddmmyyyyhh24mi|ddmmyyyy hh24mi|dd/mm/yyyy hh24:mi|ddmm hh24mi|ddhh24mi|dd hh24mi|ddmmhh24mi|ddmmyyyyhh24mi
These appear to define in what formats a user can input a date.
The one I was talking about appears to be about the *|dd|* which would imply the user can input the day and the rest will be autocompleted.
I did find another thread about this issue, but it is for 10g and they never really found out the whys and hows...
Date field in 10g Form
Thanks for your help. -
Auto Incrementing a field in a database table
Hello All,
I have created a database table for generating a unique ID, based on two key fields; Product and Area.
For a particular Product and Area,the ID generated should be unique, and it will be the third field of my table.
Is there any possible way by which i can generate the ID automatically,based on the Product And Area entered? The ID should also be automatically incremented based on the next entry.
Can anyone help me in resolving this problem?
Also, if i am deleting a particular Product and Area, will it be possible to remove the ID generated by it?
Thanks In Advance.
Shino.Hi,
If you are using a generated maintenance screen and populating the data manually your approach will need to be different.
It could be possible to use a user exit in the generated screen to populate your ID field, but you will face the risk that the user will be able to presumably over-type the ID or enter their own value.
Consider your overall requirement and design, it may be that a generated maintenance sceen is not the most suitable way to build this functionality.
Regards,
Nick -
How can I create an auto-incrementing ID field for a web app?
I have a web app for a project database. Customers can login and add a new record to the web app. We need it to provide each new project with a unique and sequential number. The BC ID number for each web app item is unique but of course not sequential (and too long). So for example the client would like all project IDs to be 4 digits starting from 1000. Any ideas?
Thanks in advance!Kapowaz,
Just thinking out loud, I wonder if you could use an Automator action to find the last invoice created and open a new file with a name based on incrementing a part of last file's filename. This would make the filename the same as the invoice number and you would still have to transfer the file's name to the content of the file.
If I had this need, I think I would create an Invoice Log document. It would be easy to have a table into which you would enter identifying data and date and have the table generate a new invoice number that you could paste into the current invoice document. It would kill two birds with one stone if you need an index of your invoices.
Jerry -
Auto populate date field in form
Hi
I have been trying to get a field in a form to automatically populate with todays date. I have got a script which defines the default value for the field as: document.dform.currentdate.value=displayfirst+"/"+displaysecond+"/"+displaythird
where dform is the name of the form, and currentdate is the name of the field.
This works fine.
But I am using the form to populate another program, and the field name must be 00N20000001QbHo
I assumed therefore that I should use: document.dform.00N20000001QbHo.value=displayfirst+"/"+displaysecond+"/"+displaythird
But this does not work. In Dreamweaver the .00 appear red.
I suspect that I need to put 00N20000001QbHo in parentheses or something similar.
Can anyone help a newbie who doesn't know what he is doing? Full script below
<form name="dform">
<input type="text" name="00N20000001QbHo" size=11>
</form>
<script>
var mydate=new Date()
var theyear=mydate.getYear()
if (theyear < 1000)
theyear+=1900
var theday=mydate.getDay()
var themonth=mydate.getMonth()+1
if (themonth<10)
themonth="0"+themonth
var theday=mydate.getDate()
if (theday<10)
theday="0"+theday
var displayfirst=themonth
var displaysecond=theday
var displaythird=theyear
document.dform.00N20000001QbHo.value=displayfirst+"/"+displaysecond+"/"+displaythird
</script>JavaScript.is.not.Java.
This is a Java forum. You could look out for a JavaScript forum at JavaScript.com. I believe JavaRanch also has one.
db -
Auto generate date field.
Is there a simple method for automatically displaying the current date in a form field? My form may take several days to run through the process I've created but the customer would like the final step's date input to be automated.
Thanks,
PatYou can create a variable of type 'date'.
Then with a setValue use the expression current-date() to get the current date.
Finally use the setValue to set the data element on your form with the value of your date variable.
Jasmin -
Auto increment a field ?
We use project number for our productions. I'd like to create a new project number for each new production that is the max(project number)+1. I guess I will have to update the database. How would I do that ?
I managed to get the max(project number) SQL command :
/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "SELECT max(pxmdvalue.value) FROM pxentity inner join pxmdvalue on pxmdvalue.entityid = pxentity.entityid WHERE pxentity .parententityid = (SELECT entityid from pxentity where address = '/project') and (pxmdvalue.fieldid=(select fieldid from pxmdfield where name='Project Number' and mdgroupcategoryid='100'));"
it works. but I need the command to update this field to +1. Anyone ?
Thanks a lot
FredHi Debasis,
Have a look on this
Quick note on IDENTITY column in SAP HANA
Regards,
Krishna Tangudu -
Auto wrap data field in a subreport
I have a subreport in my main report that displays one field. The subreport uses a stored procedure that returns one row that is made up of a CSV string. I have "Can Grow" set for the field but it does not wrap to the next line in the subreport. If the string is to long, it cuts off the end and does not display on the next line. Is there another setting I need to set? Or can I even do this?
hi,
Right click the 'Subreport' and select 'Format Subreport'.
Check the checkbox of 'Can Grow' option.
Now you will see the entire CSV string spanning across multiple lines.
Regards,
Vamsee
Maybe you are looking for
-
Hi I have update tax details in GRPO but while copy to AP invoice system pick posting date/ document date as system date and if i change the date the screen refresh and the tax details i have updated it change. that i do not want. Is there any option
-
ITunes on Windows 7 ceased expanding miniplayer after Ctrl click on thumbnail artwork.
During playback, iTunes used to expand the miniplayer album art, to full screen size, when holding the Ctrl key and clicking on the thumbnail at the top of the screen. Now the same Ctrl + click has no effect. However, after doing it, I get a double i
-
I have diff. types of document such as Word, drawing, PDF, What are the pros and cons of saving on shared file server vs. sap database (secure storage area). What is the configuration steps for each ? Thank you, Sam
-
I've brought in about 700MB of clips taken with a point and shoot digicam's video feature into a project. The twenty or so clips are each listed as 640x480(1.0),30.00fps movies. Once I've created the sequence, I haven't figured out how to make a one
-
How to implement a mask in a JtextField??? Is it possible???
I wish to have a masked edit box in Java ( a control present in VB). It is similar to a JTextField. In the control, if I specify a mask for data entry such as 99/99/9999 the box will appear on the form with dashes as --/--/----, and it will allow dat