Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Custom Text or Button Object

So I have need of what I think is a pretty simple extension, but I'm getting nowhere trying to create it myself. All I'm trying to do is create a text object or button (need to have an Action attached when clicked) that shows the number of rows of a specified chart. For example, CH01 is a chart of sales orders on hold and the custom text object would say "Orders currently on hold: 99". The extension would allow you to specify the object ID that has the rows you need counted. The user could then click on this and the chart would open/become visible. Does anyone have any guidance on creating such as extension?

10 Replies
Anonymous
Not applicable
Author

Here is what I've got so far. It seems to work fine if there is only one chart, but gets a little unpredictable when there is more than one chart. And things really get screwy if the chart is minimized (which is what I need, given the number of charts available to the user).

Qva.AddExtension('GetChartRowCount', function() {

 

  var _this = this;

  var vDoc = Qv.GetCurrentDocument();

 

  vDoc.GetAllObjects(function(objects) {

  for(var i=0; i<objects.length; i++)

  {

  var obj = objects;

     if(obj.type == 'Straight Table' || obj.type == 'Pivot Table') {  

     vObj = vDoc.GetObject(obj.id, function() {

            vObj.Layout.SetProperty('Caption.Text', 'Rows = ' + this.Data.TotalSize.y, true);

            });

        };  

    }});

});