Search code examples
lookupconditional-formattingpowerapps

Compare 2 SharePoint list items if they match fill label with colour code stored in a 3rd column


I have some hard wired code that allows me to take a list item and if it = "some text" the label fill colour will be (for example) Red

i would like to compare the first SharePoint item to another SharePoint list column item then fill the label with the colour value stored in another column

Long working version

If(
!IsBlank(
    LookUp(
        RP_Tasks_SPList, Task_Owner = Label3.Text &&  
        Text(DateValue(Date_of_Task_From), "yyyy-mm-dd") = Text(DateTimeValue(Button2_2.Text), 
"yyyy-mm-dd") &&
        Task_Type_Short = "FLT"
    )
),
Color.DarkRed,
RGBA(241,244,249, 1)
) 

Code I am trying to get to work

If(
!IsBlank(
    LookUp(
        RP_Tasks_SPList, Task_Owner = Label3.Text &&  
        Text(DateValue(Date_of_Task_From), "yyyy-mm-dd") = Text(DateTimeValue(Button2_2.Text), 
"yyyy-mm-dd") &&
        Task_Type_Short = Filter(RP_Faulting_Maintenace_Codes_SPList,FM_Code_Short)
    )
),
LookUp(RP_Faulting_Maintenace_Codes_SPList,FM_Code_Colour),
RGBA(241,244,249, 1)
) 

Any help would be much appreciated


Solution

  • This did the job

    If(
    !IsBlank(
        LookUp(
            RP_Tasks_SPList, Task_Owner = Name_Ref_Label.Text && 
    Task_Type_Short=Task_Label_Short.Text && 
            Text(DateTimeValue(Date_of_Task_From), "yyyy-mm-dd") = 
    Text(DateTimeValue(Date_Ref_Label.Text), "yyyy-mm-dd")
        )
    ),
    LookUp(RP_Tasks_SPList,Task_Type_Short = Task_Label_Short.Text,Task_Type_Long),