Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have created the follow script:
SECTION ACCESS;
LOAD * INLINE [
ACCESS, USERID
ADMIN, ADMIN
ADMIN, BETE
];
SECTION APPLICATION;
OPERADOR:
LOAD * INLINE [
CodEmp , USERID
1 , ADMIN
2 , ADMIN
3 , ADMIN
4 , BETE
5 , BETE
];
Produto:
LOAD * INLINE [
CodProd , DescProd
1 , PROD1
2 , PROD2
3 , PROD3
4 , PROD4
5 , PROD5
6 , PROD6
];
Empresa:
LOAD * INLINE [
CodEmp , DescEmp
1 , EMPRESA1
2 , EMPRESA2
3 , EMPRESA3
4 , EMPRESA4
5 , EMPRESA5
];
ProdQtd:
LOAD * INLINE [
CodEmp , CodProd , DtRefer , Quantidade
1 , 1 , 200801 , 30
2 , 2 , 200801 , 100
3 , 3 , 200801 , 50
1 , 4 , 200802 , 65
2 , 5 , 200802 , 200
3 , 1 , 200802 , 32
1 , 2 , 200803 , 45
2 , 3 , 200803 , 61
3 , 4 , 200803 , 80
1 , 5 , 200804 , 93
2 , 1 , 200804 , 26
3 , 2 , 200804 , 150
1 , 3 , 200805 , 200
2 , 4 , 200805 , 300
3 , 5 , 200805 , 243
1 , 1 , 200806 , 65
2 , 2 , 200806 , 58
3 , 3 , 200806 , 99
4 , 3 , 200801 , 10
4 , 5 , 200801 , 40
5 , 3 , 200801 , 50
5 , 5 , 200802 , 200
];
And the follow macro is executed when I open the QVW:
SUB Desabilitar
SET grafico = ActiveDocument.GetSheetObject("CH02")
SET propriedade = grafico.GetProperties
SET expressao = propriedade.Expressions
qtdexpr = expressao.Count - 1
FOR count = 0 to qtdexpr
expr = expressao.Item(count).Item(0).Data.ExpressionData
expr.Enable = FALSE
NEXT
grafico.SetProperties propriedade
END SUB
And a graphic was created with the dimensions: DtRefer from table "ProdQtd" . And six expressions too with the follow dimensions:
Rótulo = ONLY(IF(CodProd = X, DescProd))
Expressão = SUM(IF(CodProd = X, Quantidade))
The value of X ranges from 1 to 6.
I want to chage this macro to disable the expressions whose sum of the amount of product is equal to zero or null.
Is there any command that I can use to get the result of expression?
Can somebody help, please?
You can examine the contents of sheet objects by specifying the object and using row and column to identify a "cell" similar to what you might do with a spreadsheet macro. Here's an example:
set obj_total=ActiveDocument.Sheets("SH04").SheetObjects("CH11").GetCell(1,8)
'that GetCell argument is row,column
If Err.number<>0 then
msgbox("Error getting TOTAL value")
exit sub
end if
'remove editing characters and convert text to a number
current_value=CDbl(replace(obj_total.text,"%",""))
The example shows a method for removing a % character. You don't need to do that if your cell contains a number and nothing else.
Thank's Tim.