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