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:
It says that both values are in a different type.
can you help me solve that?
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.
I think is becuase as you said I am comparing Date to Text
I'm going to try to change it, thanks
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"):
The label showing True/False has this code:
So you can see, it is comparing text to dates and showing True when they match so this should work in your situation.
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:
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)
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"
Ok, but you still haven't tried wrapping your 'date' in the function DateValue(). Please try that ie
... FECHA = DateValue(Input_FechaTarea.Selected.Value) ...
Check out new user group experience and if you are a leader please create your group
Check out how to claim yours today!
Test your skills now with the Cloud Skill Challenge.