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:
It says that both values are in a different type.
can you help me solve that?
Thanks
Try Selected.Value instead of SelectedText.Value
Also, is FECHA a LookUp / Choice column? IF so, you need to use FECHA.Value
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"):
["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.
First Picture:
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"
I use date forms as "dd/mm/yyyy", I'm in Latin America
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) ...
User | Count |
---|---|
229 | |
100 | |
97 | |
56 | |
33 |
User | Count |
---|---|
280 | |
110 | |
109 | |
64 | |
62 |