0

I try do do a result binding which should do the following: The table SalesData_Extern_2 displays all the Accounts in the dataset. The selected Accounts should filter a chart SalesData_Extern_6, but via Parent Account, so that all the Accounts to the corresponding Parent Accounts show.

So when I use the generator, I get the code snippet I am supposed to insert:

column(SalesData_Extern_2.result,["Account.Parent.Name"]).asObject()

=> Is it correct to use "asObject"? Or rather "asString", "asEquality"?

Upon my understanding I can either paste the code into the SAQL query of the step SalesData_Extern_6 (chart) or I can modify the facet source in the JSON ("receiveFacetSource"). The first gives me various errors, depending on what I try do insert. Regarding the modification of the facet source, I am not sure how I should put the filter in.

The JSON looks like this:

"SalesData_Extern_6": {
                "broadcastFacet": true,
                "groups": [],
                "label": "SalesData_External_KPI_ISales_AccountParent_Donut",
                "numbers": [],
                "query": "q = load \"SalesData_SalesData\";\nq_A = filter q by date('Period_Date_Year', 'Period_Date_Month', 'Period_Date_Day') in [\"current year\"..\"current day\"];\nq_B = filter q by date('Period_Date_Year', 'Period_Date_Month', 'Period_Date_Day') in [\"1 year ago\"..\"current day\"];\nresult = group q_A by 'Account.Name' full, q_B by 'Account.Name';\nresult = foreach result generate coalesce(q_A.'Account.Name', q_B.'Account.Name') as 'Account.Name', sum(q_A.'Invoiced_Sales__c') as 'A', sum(q_B.'Invoiced_Sales__c') as 'B';\nresult = foreach result generate 'Account.Name', 'A', 'B', A-B as 'C', (A-B)/B as 'D';\nresult = order result by ('Account.Name' asc);\nresult = limit result 10000;",
                "receiveFacetSource": {
                    "mode": "include",
                    "steps": [
                        "SalesData_Extern_2"
                    ]
                },
                "selectMode": "single",
                "strings": [],
                "type": "saql",
                "useGlobal": false,
                "visualizationParameters": {
                    "parameters": {
                        "autoFitMode": "keepLabels",
                        "centerText": "",
                        "legend": {
                            "descOrder": false,
                            "showHeader": false,
                            "show": true,
                            "customSize": "auto",
                            "position": "right-top",
                            "inside": false
                        },
                        "showMeasureTitle": false,
                        "tooltip": {
                            "showBinLabel": true,
                            "measures": "",
                            "showNullValues": true,
                            "showPercentage": true,
                            "showDimensions": true,
                            "showMeasures": true,
                            "customizeTooltip": false,
                            "dimensions": ""
                        },
                        "visualizationType": "pie",
                        "title": {
                            "fontSize": 14,
                            "subtitleFontSize": 11,
                            "label": "",
                            "align": "center",
                            "subtitleLabel": ""
                        },
                        "trellis": {
                            "flipLabels": false,
                            "showGridLines": true,
                            "size": [
                                100,
                                100
                            ],
                            "enable": false,
                            "type": "x",
                            "chartsPerLine": 4
                        },
                        "inner": 60,
                        "columnMap": {
                            "trellis": [],
                            "dimension": [
                                "Account.Name"
                            ],
                            "plots": [
                                "A"
                            ]
                        },
                        "showActionMenu": true,
                        "centerValueType": "number",
                        "valueType": "percent",
                        "theme": "wave",
                        "applyConditionalFormatting": true
                    },
                    "type": "chart"
                }
            },

Could you please help me modify the JSON so that it works? Thanks!

So to update, I tried:

"query": "q = load \"SalesData_SalesData\";\nq = filter q by {{column(SalesData_Extern_2.result, [\"Account.Parent.Name\"]).asObject()}};\nq_A = filter q by date('Period_Date_Year', 
...

The error was this: "The binding 'column(SalesData_Extern_2.result, ["Account.Parent.Name"]).asObject()' contains an error: The column name 'Account.Parent.Name' doesn't exist in the data.

Account.Parent.Name exists in the DataSet and is also used in the table, but not in the chart.

However, Account.Name seems to work except that there is a grouping in the way with which Salesforce cannot deal...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.