Files
Superalgos/Projects/Foundations/Schemas/Docs-Topics/H/How/How-to-Automate-Actions-at-The-Design-Space/how-to-automate-actions-at-the-design-space-006-automating-actions-using-function-libraries.json
T
2021-10-29 08:45:41 -07:00

116 lines
4.8 KiB
JSON

{
"topic": "How to Automate Actions at The Design Space",
"pageNumber": 6,
"type": "Automating Actions - Using Function Libraries",
"definition": {
"text": "You can also utilize other functions located within the Function Libraries to help build your Action Function. In order to do this, you just need to locate the instance of the Function Library Object and call any of it's functions.",
"updated": 1628257841959
},
"paragraphs": [
{
"style": "Text",
"text": "It is a very good idea to invest some time at the Function-Libraries folder, scanning the files in there to see what you already have available to use at your actions. You will see that other actions in Function Libraries heavily rely on functions defined at one of the files within the Function-Libraries folder.",
"updated": 1628257873103
},
{
"style": "Title",
"text": "How to Call an Function Library Function?",
"updated": 1614942916741
},
{
"style": "Text",
"text": "At runtime, all Function Library objects will be already instantiated by the time your Action function code runs. You just need to get to the object that host the Function Library function you want to execute via the UI Global Object that is available to you. For example:",
"updated": 1628257884243
},
{
"style": "Javascript",
"text": "UI.projects.foundations.functionLibraries.dataStorageFunctions.createSessionReference(marketLearningProducts, session, 'Learning Session Reference')",
"updated": 1614943049167
},
{
"style": "Text",
"text": "The way to find out which is the property name of a certain Function Library object is by reading the definitions at the Project Schema File. The Function Library object hosting the createSessionReference function used in the example above, is defined at the Project Schema File in this way:",
"updated": 1614943202556
},
{
"style": "Json",
"text": "{\n \"name\": \"Data Storage Functions\",\n \"propertyName\": \"dataStorageFunctions\",\n \"functionName\": \"newFoundationsFunctionLibraryDataStorageFunctions\"\n }",
"updated": 1614943237559
},
{
"style": "Text",
"text": "The propertyName is what you need to know in order to get to the runtime reference of the Function Library object and execute it's functions.",
"updated": 1614943257490
},
{
"style": "Title",
"text": "Popular Functions"
},
{
"style": "Text",
"text": "At your own Action Function you will likely need to execute these or similar functions, belonging to popular actions defined within other Action Functions:",
"updated": 1628257991399
},
{
"style": "Subtitle",
"text": "Add a New Node"
},
{
"style": "Text",
"text": "The following is an example on how to add a new child to an existing Node:",
"updated": 1628258008587
},
{
"style": "Javascript",
"text": "dataStorage = UI.projects.visualScripting.functionLibraries.uiObjectsFromNodes.addUIObject(lanNetworkNode, 'Data Storage')",
"updated": 1614943544233
},
{
"style": "Text",
"text": ""
},
{
"style": "Subtitle",
"text": "Delete an Existing Node"
},
{
"style": "Text",
"text": "This is an example on how to Delete an existing Node:"
},
{
"style": "Javascript",
"text": "UI.projects.visualScripting.functionLibraries.nodeDeleter.deleteUIObject(projectReference, rootNodes)",
"updated": 1614943594904
},
{
"style": "Subtitle",
"text": "Establish a Reference Parent"
},
{
"style": "Text",
"text": "Example of how to set the Reference Parent of a Node:",
"updated": 1628258163153
},
{
"style": "Javascript",
"text": "UI.projects.visualScripting.functionLibraries.attachDetach.referenceAttachNode(timeMachine, session)",
"updated": 1628258141256
},
{
"style": "Text",
"text": ""
},
{
"style": "Text",
"text": ""
},
{
"style": "Text",
"text": ""
},
{
"style": "Text",
"text": ""
}
]
}