cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JoseC12
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
Eelman
Super User
Super User

@JoseC12 

Try Selected.Value instead of SelectedText.Value

 

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

Hi @Eelman 

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

@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()

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

@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

 

 

 

 

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)

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

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (91,392)