Operate on Parts of a Cloud Expression
Cloud expressions support efficient Part operations, evaluated directly in the cloud.
Create a cloud expression to store a scoreboard.
In[1]:=
ce = CreateCloudExpression[<|
"Alice" -> <|"best" -> 12, "last" -> 3|>,
"Bob" -> <|"best" -> 7, "last" -> 5|>,
"Carlo" -> <|"best" -> 31, "last" -> 12|>|>, "scoreboard"]
Out[1]=
Retrieve the best score associated to both Alice and Bob.
In[2]:=
ce[{"Alice", "Bob"}, "best"]
Out[2]=
Update both scores of a user with a higher value.
In[3]:=
ce["Alice", {"best", "last"}] = 24
Out[3]=
Retrieve the whole cloud expression with the updated values and order entries by best score.
In[4]:=
Dataset[Get[ce]][SortBy[-Part[#, "best"] &]]
Out[4]=