Page 1 of 1
[SOLVED] Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 3:19 am
by karmacomposer
I can't figure out why this does not work?
It's supposed to pre-populate a field with the current date/time
Code: Select all
on preOpenCard
put the long date into varNowDate
set the text of field "fldDateAllottStart" to varNowDate
end preOpenCard
I am using the variable varNowDate because I need to write that variable to a database later.
I have this in the card script.
Mike
Re: Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 3:31 am
by ClipArtGuy
Code: Select all
on preOpenCard
put the long date into varNowDate
put varNowDate into fld "fldDateAllottStart"
end preOpenCard
This is working here.
Re: Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 3:35 am
by karmacomposer
I will say that the field mentioned is part of a group of controls - could that be it? It's simply not working for me.
Mike
Re: Auto populate date/time in a field - not working???ou may
Posted: Fri Jul 20, 2018 3:38 am
by ClipArtGuy
Did you try the Put statement that I replaced your "set the text" line? If that's not working you might need to do something like :
Code: Select all
put varNowDate into fld "fldDateAllottStart" of grp "yourgroup" of cd "yourcard"
Re: Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 3:43 am
by karmacomposer
Should I put this in the card or stack script?
So weird - it's simply not populating that field.
Yes, I did check the properties, font and color to make sure it's not set to invisible or white on white.
Mike
Re: Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 3:56 am
by ClipArtGuy
If you want it to happen every time a card is opened, then put it into the stack script. If you want it only on one card, put it into that card's script.
Re: Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 4:07 am
by karmacomposer
OK. Very weird - I even tried a new text box field and it still did not work.
What would be a way to get the current date and time to auto populate a field? Which control should I use?
Mike
Re: Auto populate date/time in a field - not working???
Posted: Fri Jul 20, 2018 4:18 am
by karmacomposer
I got it working by attaching it to a necessary button to write to the database - not really what I wanted but it works and it's automatic.
Mike