Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello fellows,
I need to write a macro that set values to field in a table.
Anyone can help me?
Thank you
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)?
Thank you.
Sure...
Like this simple while example:
myVariable = 1
while <TABLE.END OF RECORDS>
fieldName = myVariable;
myVariable = myVariable + 1;
end while
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.
Ioannis
Ok Ioannis,
In my analysis case, i need to set value with macro code.
Like this.
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.
# | Value | Cluster |
1 | 900 | 1 |
2 | 810 | 1 |
3 | 800 | 1 |
4 | 780 | 2 |
5 | 720 | 2 |
6 | 620 | 2 |
7 | 500 | 3 |
8 | 500 | 3 |
9 | 320 | 3 |
10 | 300 | 3 |
11 | 220 | 3 |
12 | 200 | 4 |
13 | 125 | 4 |
14 | 60 | 4 |
15 | 40 | 4 |
16 | 10 | 4 |
Total | 6905 | |
25% total | 1726,25 |
sorry for asking so many questions, but I would do it as in the attached example. No use of macro.
Greate Ionannis,
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?