Closed Birbs-world closed 6 months ago
This is expected behavior, tp.system.prompt
will always return a string. If you want to coerce it into a number you can do so.
<%*
const vCostUnit = await tp.system.prompt("cost")
tp.hooks.on_all_templates_executed(async () => {
const file = tp.file.find_tfile(tp.file.path(true));
await app.fileManager.processFrontMatter(file, (frontmatter) => {
frontmatter["CostUnit"] = Number(vCostUnit); // Parse string as number
});
});
%>
first of all this plugin is a life saver hahaha Describe the bug Unless i'm not doing something correctly so it looks like templater is not treating raw numbers in the tp.system.prompt("cost") command as actual integers but as a string. this is causing an issue where another plugin (DBFolder) doesnt see it as an intiger in one of its formulas because in the frontmatter its showing as
instead of
and i confirmed that it is to do with templater not sure if the quotations are being added by the tp.system.promp or at the frontmatter["CostUnit"] = vCostUnit; its the same across all the fields that are ment to be intigers
My code:
just incase you want to know the template is being called by a meta bind button with the folowing code