Discussion Board for collaboration on QlikView Scripting.
I need to write a macro that set values to field in a table.
Anyone can help me?
Could you please clarify this a bit? What do you mean by setting values to a field in a table? internal table or table chart (straight table)?
Like this simple while example:
myVariable = 1
while <TABLE.END OF RECORDS>
fieldName = myVariable;
myVariable = myVariable + 1;
This can be done during reload easily.
But it looks like you are trying to set a field value with a macro after the reload.
If yes, then this could maybe only work with an inputfield.
Even simpler, why not make an appropriate expression in a chart?
I really need more details in order to answer that correcty.
In my analysis case, i need to set value with macro code.
1. Sum total value of a field
2. Incremental sum of this field until this sum is equal to 25% of total, then set value with 1 (cluster 1)
3. Sum next values until sum is equal 25% of total, then set value with 2 (cluster 2).
Take a look in a basic example.
sorry for asking so many questions, but I would do it as in the attached example. No use of macro.
But in my example, i used 4 cluster. In real case, it would be flexible, like 2, 3, 4 or more cluster.
In this case, I think it should be using macro, correct?
Sorry, cannot follow. if the criteria is the 25% of total sum, how could you end up with more than 4 clusters?
if qty clusters is 2, then the criteira is 50%
if qty clusters is 3, then the criteria is 33%
if qry clusters is 4, then the criteria is 25%
if qty clusters is 5, then the criteria is 16%
and so on... ;-)
last question :
what determines how many qty clusters you have?