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
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,222)