Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompt Question

Status
Not open for further replies.

MK_USF

IS-IT--Management
Mar 3, 2017
15
US
When the end user selects either "Day Shift" or "Night Shift" from the prompt I would like the select criteria to assign the following times accordingly. Can someone suggest best way to accomplish this?

I've created the below formula but I get "boolean" error. I don't think I want to use if {?Days/Nights} = "Day shift" then true else false , do I?

stringvar Starttime := "";
stringvar Endtime := "";

if {?Days/Nights} = "Day shift" then
starttime := "06:00:00" and
endtime := "17:59:59"
else
starttime := "18:00:00" and
endtime := "05:59:59"

As always, Thank you in advance.
 
Your problem is the AND

stringvar Starttime := "";
stringvar Endtime := "";

if {?Days/Nights} = "Day shift" then
(starttime := "06:00:00" ;
endtime := "17:59:59" )
else
(starttime := "18:00:00" ;
endtime := "05:59:59" )
 
Thank you.

I prompt the user for a begin and end date then I want to concatenate this with the begin time and end time established through the above formula.

Here are my concat statements in the formulas {@Display Lower Date Range} and {@Display Upper Date Range}. One for the lower date/time and one for the upper date/time.

totext(minimum({?Date Range})&" "&{?Days/Nights});
totext(maximum({?Date Range})&" "&{?Days/Nights});

In my select criteria I have:

{database.DTRECV} in datetime({@Display Lower Date Range}) to datetime({@Display Upper Date Range})

I'm getting an improper date format error. Can you suggest how to join the date prompt and the result of the days/nights prompt so the select expert will work?
 
One mistake was using {?Days/Nights} in my concat formula.

The new formulas are:
stringvar starttime;
totext(minimum({?Date Range})&" "&starttime);

stringvar endtime;
totext(maximum({?Date Range})&" "&endtime);

The report runs but I can not get the formulas above to display the starttime and endtime with the date.

Any ideas?
 
You probably want to filter on the dates and the times separately.

Let's say you selected Day Shift for March 1 thru March 4

Your records would include all day for March 2 and 3, not just Day shift.

to display your formulas you just need to make your variables shared, and create additional formulas like:

//@show start
shared stringvar starttime
 
I can not see how you are passing time in these formula

totext(minimum({?Date Range})&" "&{?Days/Nights});
totext(maximum({?Date Range})&" "&{?Days/Nights});

I think you need two formula for Start and End Times
@StartTime
if {?Days/Nights} = "Day shift" then
"06:00:00"
else
"18:00:00"

@EndTime
if {?Days/Nights} = "Day shift" then
"17:59:59"
else
"05:59:59"

then change for your date range formulae t

@Display Lower Date Range
totext(minimum({?Date Range})&" "&{@StartTime})

@Display Upper Date Range
totext(maximum({?Date Range})&" "&{@EndTime})

Ian
 
Charliy and Ian. Thank you so much for your response. Ian. I did exactly what you suggested. What took you a couple of minutes to figure out took me about an hour of trial and error. The only thing you have to do is convert it from text to datetime. Works perfectly. I even passed the date and time concatenation to a subreport.

Thank you to you both.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top