ALPHA STORE DESIGN STUDIO - authorized Yahoo! Small Business Partner
call us at (908).338.3992
 
About Us
Portfolio
System Additions for Store Pages
Custom Graphic Design. How It Works
/
BLOG: A few "tips" and "RTML secrets" of Yahoo store.

OUR BLOG: Yahoo Store from A to Z and RTML development "secrets".


RTML Operator “ACCUMULATE”

In an RTML Template, the “ACCUMULATE” operator looks like:

ACCUMULATE result_var nil
           iter_var nil
           result_init nil
           sequence nil

This operator accumulates certain values in result_var. At the beginning of iteration, result_var holds the value of the result_init variable. Sequence holds the list of objects (for example: the list of items). The ACCUMULATE operator takes elements from this list and passes them into iter_var variable one by one. Then the ACCUMULATE operator evaluates the expression assigned within it and passes the result to result_var.

Let’s look at the following example:

WITH= variable maximum-price
      value ACCUMULATE result_var maxprice
                       iter_var item
                       result_init MINNUM
                       sequence @contents
              MAXIMUM
                maxprice
                WITH-OBJECT item
                  ELEMENT position 0
                          sequence OR
                                     @price
                                     @sale-#price
  WITH= variable minimum-price
        value ACCUMULATE result_var minprice
                         iter_var item
                         result_init MAXNUM
                         sequence @contents
                MINIMUM
                  minprice
                  WITH-OBJECT item
                    ELEMENT position 0
                            sequence OR
                                       @price
                                       @sale-price
    TEXT GRAB
           "price from $"
           TEXT minimum-price
           " to $"
           TEXT maximum-price

In this example, we are defining the minimum and maximum price for the products that is in the listing page’s built-in property contents. For this purpose, we are also using RTML operators MINNUM and MAXNUM. They hold the minimum and maximum numbers in the Yahoo store system. If we want to get the minimum price, then we have to determine the maximum value first in result_init , if we want to obtain the maximum item price, then we have to determine the minimum value first in result_init. Within the ACCUMULATE operator we compare item_var and item price. Then the result will passed to item_var

Tags: , , , , ,

Leave a Reply