Georgi Koemdzhiev Posted November 20, 2019 Posted November 20, 2019 Hello, I am trying to figure out if there is a way to show the number of marked (i.e. selected) data points in a visualization (.e.g Map chart) on the WebPlayer. For example, if I mark some data points on a Map chart, I would like to know how many I have marked using the selection tool (e.g. Lasso). Is there any build-in setting that I can enable to show that kind of information on the WebPlayer If there is no such option I was looking at scripting to achieve similar functionality. For example, using a _TextArea_ that have a Button and a Label, when the button is pressed it executes the following script: #count number of rows #total row count myTable = Document.ActiveDataTableReference total = myTable.RowCount #filtered rows visible = Document.ActiveMarkingSelectionReference.GetSelection(myTable).IncludedRowCount #excluded rows filtered = total - visible print myTable.Name," total: ",total," visible:",visible, " filtered:",filteredThe problem with the above is that it always shows "0"s. EDIT: When I executed that on an analysis document that has a "embedded" data it worked fine. I am trying to count the marked rows in analysis document that get's it's data from an "External" data source (i.e. SQL server)
Shandilya Peddi Posted November 20, 2019 Posted November 20, 2019 I tried your script and works for me as expected. Shows the number of marked rows as "visible"
Georgi Koemdzhiev Posted November 20, 2019 Author Posted November 20, 2019 Hi Shandilya. The script does not work for me, perhaps it's due to the fact that I am using "External" data (i.e. SQL server)
Shandilya Peddi Posted November 20, 2019 Posted November 20, 2019 Yup, that would bethe reason why you do not see any output. You cannot get the marking details when the data table is external. If you need to get the selected rows you can try 1 of the below, 1. Import the data table 2. Keep this data table external and add a new imported On-demand data table which loads the marked data. Run the IronPython script on this Ondemand data table to find the row count https://support.tibco.com/s/article/Retrieve-marked-values-from-In-Datab...
Georgi Koemdzhiev Posted November 20, 2019 Author Posted November 20, 2019 Thank you very much for the swift response! I will look into adding a On-Demand data table method you suggested as I need to display to the user the number of selected rows. Thanks a lot! P.S.: Is there a way to "hook" into the "on-select" event so that I can execute that IronPython script every time the user marks something on a visualization
Shandilya Peddi Posted November 20, 2019 Posted November 20, 2019 You can use Data Functions to trigger an IronPython script on marking/fitlering in general. Can you try out the procedure provided in the following KB and see if it helps, https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-45663
Georgi Koemdzhiev Posted November 20, 2019 Author Posted November 20, 2019 Looks exactly what I needed, awesome! Will try that, thanks again :)
Anders Gavare Posted November 21, 2019 Posted November 21, 2019 I tried this with External data (Microsoft SQL), and it worked for me: In the Analyst client: From the map chart, select the data points of interest (using Lasso or other means) Right-click and select Create Details Visualization -> Cross Table. Configure the cross table to show Row Count as the measure, and None on both the X and Y axes. Then, many of the visible things in the cross table can be removed (the legend can be hidden, the title bar can be hidden, the axis selectors can be hidden, the cell values expression can be set to "count() as []" rather than just "count()" for example to hide the measure name). Save the analysis to the library and open it in the web player. The update of the Count in the cross table still works fine. (I know this isn't in a Text area, but it may be good enough in some cases.) If you want something more complicated, such as UniqueCount of some ID or other column (say, if you want to show the number of cities or stores that you have marked but each row represented a transaction), then that is simple to accomplish by just changing Count() to UniqueCount(column).
Georgi Koemdzhiev Posted November 21, 2019 Author Posted November 21, 2019 Thank you for your answer, agavare. I like how much simpler is your solution in comparison to the one proposed by Shandilya. I will experiment and try both of the suggested solutions and propose those to our client. They both propose different pros and cons. Thanks again :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now