INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Prompt Question

## Prompt Question

(OP)
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.

### RE: Prompt Question

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" )

### RE: Prompt Question

(OP)
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?

### RE: Prompt Question

(OP)
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?

### RE: Prompt Question

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

### RE: Prompt Question

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

### RE: Prompt Question

(OP)
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.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!