With({x:ThisItem.Created},With({y:Now()},If(DateDiff(x,y,TimeUnit.Seconds)<60,DateDiff(x,y,TimeUnit.Seconds)&" sec ago",If(DateDiff(x,y,TimeUnit.Minutes)<60,DateDiff(x,y,TimeUnit.Minutes)&" min ago",If(DateDiff(x,y,TimeUnit.Hours)<24,DateDiff(x,y,TimeUnit.Hours)&" hr ago",If(DateDiff(x,y,TimeUnit.Days)<30,DateDiff(x,y,TimeUnit.Days)&" day(s) before",If(DateDiff(x,y,TimeUnit.Months)<12,DateDiff(x,y,TimeUnit.Months)&" month(s) ago",x)))))))
Thursday, June 29, 2023
How to use named formula
Named formula will calculate automatically, see examples below
themeFill = If(_appTheme = "Dark",_appDarkFill, _appLightFill);
themeColor =If(_appTheme = "Dark", _appLightColor,_appDarkColor);
userScore = With({x:Sum(Filter(Posts, PostEmployeeID = _userID),Score)},If(x<0,0,x)) ;
Here instead of writing the condition again and again we written once for each control.
Now see below
selectedPost = First(Filter(Posts,PostID = _selectedItem.PostID));
avatar = LookUp(Avatars, ID = _userAvatarID1).Thumbnail.Small;
Whenver selectedPost is changed we gave the ;latest selectedPost object.
Wednesday, June 28, 2023
User().Email or Office365Users.MyProfile().Mail
Always use Office365Users.MyProfile().Mail because this is the field that will be extracted when you use people field in SharePoint as email
Monday, June 26, 2023
Show datetime with reference to current time
With(
{
x: First(
Filter(
Posts,
PostID = ThisItem.PostID
)
).Created
},
With(
{
y: Now()
},
If(
DateDiff(
x,
y,
TimeUnit.Seconds
) < 60,
DateDiff(
x,
y,
TimeUnit.Seconds
) & " secs",
If(
DateDiff(
x,
y,
TimeUnit.Minutes
) < 60,
DateDiff(
x,
y,
TimeUnit.Minutes
) & " min(s)",
If(
DateDiff(
x,
y,
TimeUnit.Hours
) < 24,
DateDiff(
x,
y,
TimeUnit.Hours
) & " hour(s)",
If(
DateDiff(
x,
y,
TimeUnit.Days
) < 365,
DateDiff(
x,
y,
TimeUnit.Days
) & " days(s)",
x
)
)
)
)
)
)
Tuesday, June 20, 2023
Add a blank option for a dropdown
ClearCollect(
coll_EHSCategory,
""
);
//First add a ClearCollect with "" and then use Collect
Collect(
coll_EHSCategory,
Distinct(
Filter(
'EHS Master List',
Title = var_SelectedItem.'EHS Type'
),
'EHS Category'
)
);
Thursday, June 1, 2023
Power Automate - Filter Sharepoint Items based on a datetime column
Created ge datetime'@{outputs('Get_item_Last_Run')?['body/LastRun']}' // add '' and the column needed
Add Service Principle support in Custom Connector
then search for "Streamlining Integration: Using Service Principal authentication on Custom connectors with Microsoft Graph Applicati...
-
Created ge datetime '@{outputs('Get_item_Last_Run')?['body/LastRun']}' // add '' and the column needed
-
W e have a variable - 'longText' having a long list of characters and we want to trim the characters after a limit e.g. 130 charact...
-
If coll_Origin is a collection containing Value as different option fields & OriginSelected is flag telling its selected or not, on an ...