fromFile not a built-in function in Create in Property, but it exists in Bot Responses
See original GitHub issueDescribe the bug
When I try to ‘Set Property’ and ‘Create Expression’ I add the following using the autocomplete prompts in Composer =json(fromFile(user.path))
Despite the inbuilt prompts I get a warning “Set a property: value fromFile does not have an evaluator, it’s not a built-in function or a custom function.” when adding the property.
If I add a Bot Response template using - ${json(fromFile(user.path))}
or when I add this as a dialog response, so the fromFile function obviously exists.
Version
Version: 2.1.0 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0
Browser
- Electron distribution
- Chrome
- Safari
- Firefox
- Edge
OS
- macOS
- Windows
- Ubuntu
To Reproduce
Steps to reproduce the behavior:
- Go to ‘Create’
- Click on ‘+ Add > Manage properties > Set a property’
- Click to enter the expression ‘=json(fromFile(user.path))’
- Problems [Warning] (highlight in Composer): Set a property: value fromFile does not have an evaluator, it’s not a built-in function or a custom function. Please add unknown functions to setting’s customFunctions field.
Expected behavior
I would expect the expression to set the property for the JSON against the assigned user.jsonobject, similar to the way it creates the object in a Bot Response template.
Additional context
Calling the Bot Response template allows me retrieve specific values from the JSON object, but using that method I am not able to pass those into a property - I want to be able to do that to use Collection functions. The JSON I am using will be static so I want to access files in the project instead of calling out to Cosmos DB each time I want to access the data.
When creating the property I have tried a number of combinations including adding as a String and an Object, and using as an expression (using the prompts) and also just pasting in the code ${json(fromFile(user.path))}
that works in the Bot Response template and directly as ‘Send a response’.
I can see where to add a custom function, but have no idea what to add for fromFile.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top GitHub Comments
@azurecloudmatt, confirming that fromfile() is only going to be available in LG, not from expressions used elsewhere. So I will go ahead and change this issue from a bug to a Feature Request.
@anusharr, I have been doing some further reading into this, does this document mean that fromFile() is only available in LG? Functions injected from LG - fromFile
Is there a way to add fromFile() to expressions in set a property?
If there is no way to add the LG function to expressions in Composer, can you change this ticket from a Bug to a Feature Request? Remove references of non-available functions from the expression builder part of Composer?