Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a suitable KeyValuePattern from an example association
ResourceFunction["GetKeyValuePattern"][assoc] creates a KeyValuePattern using assoc as a template. | |
ResourceFunction["GetKeyValuePattern"][assoc,level] creates a nested KeyValuePattern using assoc down to level. |
Retrieve the ResourceFunction:
| In[1]:= |
| Out[1]= |
Get a suitable KeyValuePattern from an example Association:
| In[2]:= |
| Out[2]= |
By default, the first level is used:
| In[3]:= | ![]() |
| Out[4]= |
Specify a different level:
| In[5]:= |
| Out[5]= |
Use every level:
| In[6]:= |
| Out[6]= |
Get formatted output for easier copy and paste into an editor:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
Create a function that returns data from the cloud while making sure the structure of the data matches a sample:
| In[14]:= | ![]() |
| In[15]:= |
| Out[15]= | ![]() |
Now create a pattern to test against for all responses from the server:
| In[16]:= |
| Out[16]= |
| In[17]:= | ![]() |
Under normal circumstances, the function just returns the output from the deployed CloudObject:
| In[18]:= |
| Out[18]= | ![]() |
Now if you encounter data types that you did not plan for, you can have error handling:
| In[19]:= |
| In[20]:= |
| Out[20]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License