Jump to content

Pulling year from date/time field into new column in table


Recommended Posts

Hi all,

I'm trying to automate a column in a table.

The datapage is a web form that is keyed in by staffers. The date/time field is automatically recreated when they submit an entry.

I'd like a new column to pull the year from that date field, also automatically, to save key strokes on deadline.

Is there a way to do that?

My head is unable to wrap around it this morning.

page is at: http://www.kentucky.com/2009/08/19/9008 ... -line.html

the year field works in 2008 and 2009, but not 2010.

Linda J.

Link to comment
Share on other sites

hi,

As I understood, you have a table which has a date field. In the same table, now you want to create a new column which will save only year that is present in the existing date field. So, I thought I will see a submission form. The link you provided has a search form. Please explain if I missed something.

Link to comment
Share on other sites

Hello,

You can try this Java Script in the footer of the submission page:

function findY()

{

var myYear= document.getElementById("InsertRecordDATEFIELDNAME").value;

document.getElementById("InsertRecordYEARFIELDNAME").value= myYear.substr(6,10);

}

document.getElementById("caspioform").onsubmit = findY;

Replace field names with your own field name.

Hope that helps.

Regards,

NKamalan

Link to comment
Share on other sites

Hi Linda,

I just noticed that you have a date field that is automatically recreated when users submit an entry. Is a submission page or an update page? Is it a Timestamp field in the table? If yes, then you won't be able to use the JavaScript I provided. You can use this script when you have a date field in the form and user can select the date from pop calendar.

Can you please explain what do you need the year for? And why do you need to have both year and date in the table? the reason I am asking is, maybe there is another easier way that you can create this app.

If you can please elaborate more, I will be able to provide you with a better solution.

Regards,

NKalaman

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...