cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

In between function for App

Hello everyone,

 

currently i'm building an App,where it is possbile to book a bike.

With my code I'm able to check a date + time and the number of the bike, but i'm not able to check the time in between. For example: I book a bike from 12.12.2019 at 5pm to 7 pm on the same day, but once i change the time from 6pm to 7pm, it just goes thru, even its booked from 5 - 7 pm.

What can i do, that my code does a check, if its gone between that time or date?

 

If(
LookUp(     
booking;   
DataCardValue9.Text = bikenumber&& 
 
Value(Datum_x0020_PickUp;"[$-de-DE]dd/mm/yyyy HH:mm") >= Value(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value); Value(MinuteValue1.Selected.Value); 0))
&& 
Value(Datum_x0020_Return;"[$-de-DE]dd/mm/yyyy HH:mm")= Value(DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value); Value(MinuteValue2.Selected.Value); 0));

"OK" 
    ) = "OK";
Set(
 MyView; "It doesnt work"
 );
   

Set(
 MyView;
 "It works" & SubmitForm(EditForm1)
    )
)

hope someone has an Idea, what to do.

Thanks alot

 

5 REPLIES 5
Highlighted
Resolver II
Resolver II

Re: In between function for App

try to split date and time, this you can check if this date is already picked for this bicycle and if the time you want to rent it another time is outside the time slot of already hired bike. if date is true but time is false then it is ok to rent it out again.

Highlighted
Anonymous
Not applicable

Re: In between function for App

@Sijts  i tried something like that before, but mostly had problems with that. Could you show me in code, how you would do it?

Thanks alot in advance

Highlighted
Resolver II
Resolver II

Re: In between function for App

I do not have some code, but why don't you try a filter?

that way a the possible options will be filtered out.

first(filter(bookings, where this and that)).bikeno <>""

 

Highlighted
Community Support
Community Support

Re: In between function for App

Hi @Anonymous ,

Try this formula:

If(
     IsEmpty(LookUp(     
             booking;   
             DataCardValue9.Text = bikenumber&& 
             Value(Datum_x0020_PickUp;"[$-de-DE]dd/mm/yyyy HH:mm") >= Value(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value); Value(MinuteValue1.Selected.Value); 0))
             && 
             Value(Datum_x0020_Return;"[$-de-DE]dd/mm/yyyy HH:mm")= Value(DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value); Value(MinuteValue2.Selected.Value); 0))
             );
      variable1=true;variable1=false 
   )


If(variable1=false; Set( MyView; "It doesnt work" ); Set( MyView;"It works" );;SubmitForm(EditForm1) )

 

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Re: In between function for App

Hey @v-yutliu-msft 

 

it doesnt work with "variable1" and i have to use for lookup that "Ok" = "Ok" otherwise it doesnt take it.

 

Not sure to be honest.

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,982)