Page 1 of 1

[Solved] Date as input variable to a query?

Posted: Fri Jan 07, 2011 8:56 pm
by akillenb
I'm a newb, so forgive me if this has an obvious answer.
I need to be able to structure queries based on a specific date as input.
While I can put a conditional in the query as, for instance, :MMDDYY, when the query is run, all it shows is the MMDDYY, and I cannot determine how to get the "/" characters to display, or to get the field treated as requiring a date as input.
The ideal or ultimate solution would be to have a selectable calendar appear as the input popup.

Re: Date as input variable to a query?

Posted: Fri Jan 07, 2011 9:11 pm
by r4zoli
The parameter query use ISO date format: YYYY-MM-DD.
You can ad :start_date it will show as start_date, when dialog opens add 2011-01-01.

Re: Date as input variable to a query?

Posted: Fri Jan 07, 2011 9:20 pm
by akillenb
Thanks. It's not so much a question of whether or not I can use a date as input - nearly anything I put after the ":" will cause a query input popup - what I'd like to do, is make it obvious that it needs to be a date, and what the format needs to be. The current format definition in the table is MM/DD/YY.

Re: Date as input variable to a query?

Posted: Fri Jan 07, 2011 9:50 pm
by Villeroy
The format definition is completely irrelevant. You can always enter 2010-12-31 (ISO) regardless of format. Depending on the respective application locale any of 31.12.10, 31/12/10 or 12/31/10(US) stores the same date value to the field.
In a form you can use date controls with or without pop-up calendar or masked fields to enter digits only. And yes, subforms can be bound to parameter queries with parameters substituted by the parent form.
http://user.services.openoffice.org/en/ ... 944#p62944 (date parameter in form)
http://user.services.openoffice.org/en/ ... 36#p102636 (date-time input mask)

Re: Date as input variable to a query?

Posted: Fri Jan 07, 2011 10:39 pm
by akillenb
Thanks again. But let me try to rephrase the question again.
I can make it work, since I know what the input parameter needs to be.
If I were to say to a non-technical user: here, use this form, they cannot tell that the input parameter needs to be a date, or what, exactly they need to enter.
Assuming that the query was to be used by multiple non-technical people, what sort of value could i substitute, for mmddyy in the criterion field to a) make it obviously a date, and b) what format it should be:
screen capture
screen capture

Re: Date as input variable to a query?

Posted: Sat Jan 08, 2011 10:37 am
by r4zoli
It depends on your users understanding of pop-up message, if it contain start-date and end_date i presume they will try to add some date into. It is your task to teach them to use 2010-01-01 (ISO) format in such cases.

Re: Date as input variable to a query?

Posted: Sat Jan 08, 2011 11:57 am
by Villeroy
akillenb wrote:Thanks again. But let me try to rephrase the question again.
I can make it work, since I know what the input parameter needs to be.
If I were to say to a non-technical user: here, use this form, they cannot tell that the input parameter needs to be a date, or what, exactly they need to enter.
You did not try my example files. One has a calendar control which accepts dates ony and can be turned into a drop-down calendar, the other form takes only the digits in 2010-12-23 13:45:59 .
Why do you employ completely computer illiterate people for data entry? Do you really believe it is cheaper to not raise their level to a certain degree of basic knowlege?

Re: Date as input variable to a query?

Posted: Sat Jan 08, 2011 9:26 pm
by akillenb
No - I did look at your examples - they didn't do any more than what I already knew how to do, though they used a slightly different approach.

If I were a programmer, or database wizard, I suppose I would know better how to word things to get my answer from others.
I've got forms for data entry with drop-down date selection. What I wanted to do was something like change the label in a query popup, to something more understandable than "Parameters" or to be able to make it a date format showing the dashes "-" or slashes "/" - As to training - since if this were to be used, it would be by whomever was counting donations at a church, it's not possible to train the entire population.
Sigh - guess we'll call it solved, for now.