Guide to Creator's Function Selector Window
The Function Selector Window is used to load the desired function in various parts of the creator. This same window is used or opened as part of data sources, actions, and scripts. Functions are pieces of code that perform a specific action. For Data Sources, function get data. For action calculation functions, they take in data and return an output. For scripts, functions can do anything that they're requested of. The function selector is used in all of those places to generate or load functions for the user.
Below is an example of what the function selector window could look like on the 'Code' tab. Note at the top, there are two tabs, 'Code' and 'Library'.
In the below sections of this page, we'll go over these two pages, 'Code' and 'Library' and how to use them.
For reference, the above code page of the function selector is annotated, each of these parts are expanded on below.
To use the in-app code generation, an Open AI api key must be set in Howdy Coder. To set this, you use the API Key Window. Click for instructions for that window. If you do not set this key, this red warning will be there and the Code Generation Prompt section will not be enabled. If the key is valid and set, this warning will be gone.
You can use this text edit and the buttons to the right to ask AI to generate code for you. The appropriate AI Prompt will be automatically added to what you ask for when sending to the AI. This section is only enabled if the Open AI API key is set, and the warning above is not displayed. If you're looking to create new code/function, use the 'Create New Function'. If you're asking the AI to modify code in the code editor below, use the Modify Function button.
When you use either of the buttons to the side after entering your prompt in the box, the text in the box will change. Your prompt will be replaced with a message informing you the AI is generating the code. This may take some time, do not close the window or make other changes to the window during this time.
If there are multiple functions in the code editor, the entry function has to be specified. Basically in this edit, specify which function is the main function. The rest of the functions should just be helper functions. If you're using AI code generation, it should fill this out automatically. The default entry function is the last function.
This is where the code of the function should go. Code in here will automatically be analyzed to make sure it compiles and meets a few specifications. If it doesn't compile or doesn't meet all the rules, an error message will be shown at the bottom and the Select/Save buttons will be disabled. If you use the Code Generation Prompt Editor to ask the AI to generate code for you, it will be automatically placed in the code editor. If you are generating or creating the code outside of the in-app resources, you can paste the code in this editor. After pasting the code will be analyzed. It is NOT recommended to type in this editor directly, it will automatically lock editing after a few seconds of no typing to check for compilation.
If you had AI generate the code for you in-app, then the explanation for the code will be added to a textbox that can only be seen by click on the arrow with the "Explanation" label. This will cause a second text view to appear and expand. The explanation can be useful to see what the AI was thinking when it generated the code. You can verify the AI was following your instructions. The explanation view can be collasped and hidden from view using the same button.
When you have valid code, you can choose to either select the function or save the function. When you select, the Function Selector window will be closed and the function you selected will be passed back to where the window was open from. If you choose to save, a save file dialog will be opened asking you to save the function to a library file. This library file can then be loaded in elsewhere so you could use the same function again. You can save to an already existing library file and the function will be added to that library. You can see more about function libraries on the below Library Page section. Saving the function will not close the window, and will not select the function either. Note: These buttons will only be enabled if there is valid code in the code editor.
Section under construction, check back later.