โ05-26-2022 09:35 AM
Iโve searched for examples but not having much luck.
My data in the .expr file looks similar to this:
Accounts:
{
projectspace:
{
ProjectName:
{
Salesforce
{
Dev:
{
account_name : โSalesforce CIDEVโ
},
}
โฆ
I wrote a parsePath function call that would pull the project space and project. The function whereAmI uses getOrgName to determine the environment. Then ultimately, Iโd like one call to get the Account based on the projectPath + type + env to get a single result.
getOrgName: pipe.plexPath.split(โ/โ)[1],
parsePath: x => (x.split(โ/โ)[x.split(โ/โ).length-2].replaceAll(" โ,โโ) + โ.โ + x.split(โ/โ)[x.split(โ/โ).length-1].replaceAll(โ โ,โ")),
whereAmI: this.getOrgName.toLowerCase().contains(โprodโ) ? โProdโ : (this.getOrgName.toLowerCase().contains(โtestโ) ? โTestโ : โDevโ),
getAccount: (path,type) => this.Accounts[this.parsePath(path)][type][this.whereAmI],
parsePath returns โprojectspace.ProjectNameโ and whereAmI returns โDevโ. Iโd like to pass in type as โSalesforceโ. I know getAccount isnโt right. I just wanted to represent what Iโm trying to do. Iโve made many variations to it without luck. I basically want to call lib.expr_lib.getAccount(pipe.projectPath,โSalesforceโ) and return the value โSalesforce CIDEVโ.
Appreciate any help!
Thanks.
Melissa
โ06-02-2022 10:46 AM
@mmussitsch Viktor is using the code format option on this site (</> from the toolbar above the text box.)
โ06-02-2022 12:16 PM
Oh okay @dmiller - thank you! Do wish Notepad++ had these helpers. But good to know next time I post code.
โ06-02-2022 12:19 PM
The expression library should be fairly compatible with JavaScript syntax, so you could apply that syntax and formatting in Notepad++ (or other editors) for a decent way to grok the expression library.
โ06-02-2022 12:35 PM
Yes! Way better โฆ thanks @tlikarish