Complicated If statement column format
-
16-02-2021 - |
質問
I've been struggling with this for a few days now and wondered if anyone could help!
I have a SharePoint list (attendance tracking) with 4 date columns:
- Arrival Time (this is filled-in using [Today] by default when the item is created)
- Sign-out
- Sign-in
- Exit Time
And a text column called Status.
I want the Status column to quickly show whether the person is in the building, or out, based on the 4 date columns (e.g. if there is a time/date in the Arrival Time column, but not in Sign-out column then they are in the building.
I am trying to adapt some json on GitHub but I am really struggling to get the if statements down!
This is ideally what I want to achieve:
Any help would be greatly appreciated!
解決
Try the following:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(Number([$SignOutTime])!=0 && Number([$ExitTime])!=0, 'Out', if(Number([$SignOutTime])!=0 && Number([$SignInTime])==0,'Out',if(Number([$ArrivalTime])==0, 'Out', 'In')))",
"attributes": {
"class": "=if(Number([$SignOutTime])!=0 && Number([$ExitTime])!=0,'sp-field-severity--severeWarning',if(Number([$SignOutTime])!=0 && Number([$SignInTime])==0,'sp-field-severity--severeWarning',if(Number([$ArrivalTime])==0, 'sp-field-severity--severeWarning', 'sp-field-severity--good')))"
}
}
所属していません sharepoint.stackexchange