Options

Why variables are used on statistics pages and not fields?

Brax007Brax007 Member Posts: 26
Hello everyone,

I have this question confusing me since forever, When do I use fields and when to use variables to have dynamics values calculated when opening a page?
what's wrong with the use of fields from a table instead of variables ?

Thanks in advance

Best Answer

Answers

  • Options
    DenSterDenSter Member Posts: 8,304
    edited 2020-03-03
    Statistics pages ARE using fields, they are just used to set variables in the page in the logic that renders the statistics pages. Many statistics pages use the same field multiple times with different filters.

    Take, for instance, the Item Statistics page. You can show values per day, week, month, year. Those values are calculated based on the user selection when the matrix is calculated. There is no way to provide those values as flowfield values. Let's say you want to show values by month. Do you create 12 fields for 12 months at the table level? Is that enough? What about the need to compare last year's values? Do you create 24 columns for month? Let's say you want values by week, how many fields do you create? 12 for a quarter? 26 for half a year? 52 for a whole year? Do you then need 104 columns to also have last year's numbers?

    A statistics page uses the same field and calculates it however many times you need for however many columns you need. You start the Item Statistics page and debug it, with selecting different settings. See what it does, discover how it works. Do the same for Customer Statistics, and order statistics. Get a feel for how it really works.
  • Options
    Brax007Brax007 Member Posts: 26
    Thank you DenSter for your response, but in general, in a page if you have data calculated on an open page for example, what's the difference between using variables to stock the result and show it on the page or juste stock the result in a table field?
  • Options
    edoderooedoderoo Member Posts: 89
    In a variable you can do much more then in a stored field, or a dynamically calculated flow field. For example the "stock value" is a rather simple calculation from stock * cost price, but when you use different cost price methods, it is already more sophisticated. But without variables, you can't calculate it for sure.
    IF User.Loves('Edo') THEN ok() ELSE currReport.genSkip;
  • Options
    txerifftxeriff Member Posts: 492
    Statistics page (when you press F9) all the data is calculated dynamically, that´s why it uses variables to place it in the screen (a bunch of arrays and other calcs)
Sign In or Register to comment.