cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Lookup Function

Good afternoon,

I have a lookup function:

 

IsBlank(
            LookUp(
                TAREA;
                'TEAM MEMBER'.Value = Input_TeamMemberTarea.Selected.Value && FECHA = Input_FechaTarea.SelectedText.Value && SERVICIO.Value = Input_Servicio.Selected.Value
            )
        );

 

 'TEAM MEMBER', 'FECHA' and 'SERVICIO' are columns in TAREA list
but I have an error:
error.PNG

It says that both values are in a different type.

can you help me solve that?

Thanks

15 REPLIES 15
Highlighted
Super User II
Super User II

@JoseC12 

Try Selected.Value instead of SelectedText.Value

 

Also, is FECHA a LookUp / Choice column? IF so, you need to use FECHA.Value

Highlighted

Hi @Eelman 

FECHA is a Date&Time column so I cannot put FECHA.Value

Highlighted

@JoseC12 

Well there is your issue. You are comparing Date to Text. Are you using a textinput to enter a date? If so, why not use a DatePicker? Solves a lot of issues.

 

However, if you insist on using a textinput wrap that in DateTimeValue()

Highlighted

I don't use DatePicker because I restrict only the dates where a week is selected. I created dates which has week (Single text value). In a dropdown I have those weeks and if I select one of them, then I have only 7 options to register.

ERROR 1.PNGERROR 2.PNG

I think is becuase as you said I am comparing Date to Text

I'm going to try to change it, thanks

Highlighted

@JoseC12 

I just tested it on my side and if you setup your 7 options in the format "mm/dd/yyyy" you can use this to convert and compare:

FECHA = DateValue(Input_FechaTerea.Selected.Value)

 

The Dropdown1 below has items (format = "mm/dd/yyyy"):

["03/01/2020","03/02/2020","03/03/2020","03/04/2020"]

The label showing True/False has this code:

DateValue(Dropdown1.Selected.Value)=DatePicker1.SelectedDate

 

So you can see, it is comparing text to dates and showing True when they match so this should work in your situation.

TextToDate.gif

 

 

 

 

Highlighted

First Picture:

EDIT FORM.PNG

This is my edit form and it appears the dates that corresponds to a week selected.

But If I create a record with the same Team member, Date (Fecha) and Service (Servicio), it allows me not to create that again.
that's why I put:

If(
        IsBlank(
            LookUp(
                TAREA;
                'TEAM MEMBER'.Value = Input_TeamMemberTarea.Selected.Value && FECHA = Input_FechaTarea.SelectedText.Value && SERVICIO.Value = Input_Servicio.Selected.Value
            )
        );
        SubmitForm(Form_PlanearTarea)

The '=' icon gets me a warning message: 'Comparing values are not the same type'

When I click the save button I don't want this to happen: 
Same date.PNG

Just I don't want the app to allow me to save that record

 

Also I have this column (FECHA) type as Date&Fecha and I changed the DatePicker into a dropdown as you see in the first picture.
Only this that to Filter the dates with the column (You can read more about that situation: https://powerusers.microsoft.com/t5/Building-Power-Apps/Distinct-function/m-p/486496#M146897

the second message I wrote down below)

 

When I save the date it saves as a string type as you said. 

It only works well if I make FECHA column as Lookup column, and in the Items property shows 'Choices(TAREA.FECHA)

Highlighted

@JoseC12 

Inside your IsBlank, try this to get rid of the error

FECHA = DateValue(Input_FechaTarea.Selected.Value)

If this doesn't work, change your dropdown dates to "mm/dd/yyyy" they are currently "dd/mm/yyyy"

Highlighted

I use date forms as "dd/mm/yyyy", I'm in Latin America
ERROR 1.PNG

Now it reads as a Date type but stills gets me an error

Highlighted

Ok, but you still haven't tried wrapping your 'date' in the function DateValue(). Please try that ie

 

... FECHA = DateValue(Input_FechaTarea.Selected.Value) ...

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

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