Browse All Fiddles


Updating order array order_status from Pending to In Progress

Simply changes any order_Status that is "Pending" to "In Progress"
Created: 1498090111
View "Updating order array order_status from Pending to In Progress"
<mvt:comment> | | By http://www.scotsscripts.com | </mvt:comment> <mvt:assign name="l.settings:order[1]:id" value="'1'" /> <mvt:assign name="l.settings:order[1]:order_status" value="'In Progress'" /> <mvt:assign name="l.settings:order[2]:id" value="'2'" /> <mvt:assign name="l.settings:order[2]:order_status" value="'In Progress'" /> <mvt:assign name="l.settings:order[3]:id" value="'3'" /> <mvt:assign name="l.settings:order[3]:order_status" value="'Pending'" /> <mvt:assign name="l.settings:order[4]:id" value="'4'" /> <mvt:assign name="l.settings:order[4]:order_status" value="'In Progress'" /> <p><b>Original:</b></p> <mvt:foreach iterator="item" array="order"> id: &mvt:item:id; status: &mvt:item:order_status;<br> </mvt:foreach> <mvt:assign name="l.elements" value="miva_array_elements(l.settings:order)" /> <mvt:while expr="l.counter LT l.elements"> <mvt:assign name="l.counter" value="l.counter + 1" /> <mvt:assign name="l.struct" value="l.settings:order[l.counter]" /> <mvt:if expr="tolower(l.struct:order_status) EQ 'pending'"> <mvt:assign name="l.struct:order_status" value="'In Progress'" /> </mvt:if> <mvt:assign name="l.success" value="miva_array_insert( l.settings:temp_array, l.struct, -1 )" /> </mvt:while> <mvt:assign name="l.settings:order" value="l.settings:temp_array" /> <p><b>Updated:</b></p> <mvt:foreach iterator="item" array="order"> id: &mvt:item:id; status: &mvt:item:order_status;<br> </mvt:foreach>
 

Basket #47956

Created: 1497964333
View "Basket #47956"
<mvt:comment> <!-- Welcome to Miva <snippets/> You can enter standalone blocks of Miva template code then Run or Save your code to see the result. Try inserting a snippet by clicking an Insert from the left or select the Learn/Browse menu items to see some examples --> </mvt:comment>
 
View "miva_array_delete() within mvt:foreach"
<h1>miva_array_delete() within mvt:foreach</h1> <mvt:assign name="l.settings:example:list[1]" value="'Bananas'" /> <mvt:assign name="l.settings:example:list[2]" value="'Milk'" /> <mvt:assign name="l.settings:example:list[3]" value="'Bread'" /> <mvt:assign name="l.settings:example:list[4]" value="'Cereal'" /> <h4>Before:</h4> <mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:example), ',', '<br>'))" /> <mvt:foreach iterator="item" array="example:list"> <mvt:if expr="l.settings:item EQ 'Milk'"> <mvt:assign name="l.result" value="miva_array_delete( l.settings:example:list, l.POS1, 1 )" /> </mvt:if> </mvt:foreach> <h4>After:</h4> <mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:example), ',', '<br>'))" />
 

Basket #47914

Created: 1497900663
View "Basket #47914"
<div class="column whole cart-contents"> <div class="row all-hidden medium-all-shown basket-header-row"> <div class="column one-eighth">Order #</div> <div class="column one-eighth">Order Date</div> <div class="column one-eighth align-right">Order Total</div> <div class="column one-fourth">Order Status</div> <div class="column three-eighths">Shipments</div> </div> <mvt:foreach iterator="order" array="orders"> <mvt:assign name="l.settings:list[1]" value="'Order #'" /> <mvt:assign name="l.settings:list[2]" value="'Order Date'" /> <mvt:assign name="l.settings:list[3]" value="'Shipment'" /> <mvt:do file="g.module_library_utilities" name="l.null" value="QuickSortArray(l.settings:list, '', -1)" /> <div class="row basket-product-row"> <div class="column half medium-one-eighth"><strong class="medium-all-hidden">Order # </strong>&mvt:order:id;</div> <div class="column half medium-one-eighth"><strong class="medium-all-hidden">Date: </strong>&mvt:order:date_formatted;-1</div> <div class="column half medium-one-eighth medium-align-right"><strong class="medium-all-hidden">Total: </strong>&mvt:order:formatted_total;</div> <div class="column half medium-one-fourth"><strong class="medium-all-hidden">Status: </strong>&mvt:order:order_status;</div> <div class="column three-fourths medium-one-fourth"> <strong class="medium-all-hidden">Shipments: </strong> <mvt:foreach iterator="shipment" array="order:shipments"> &mvt:shipment:tracklink;<br /> </mvt:foreach> </div> <div class="column one-fourth medium-one-eighth align-center"><a href="&mvt:global:secure_sessionurl;Screen=ORDS&amp;Store_Code=&mvta:global:Store_Code;&amp;SortBy=&mvta:global:SortBy;&amp;Offset=&mvta:global:Offset;&amp;Order_ID=&mvt:order:id;&amp;Order_BillEmail=&mvte:global:Order_BillEmail;&amp;Order_BillZip=&mvte:global:Order_BillZip;" class="button button-mini bg-gray charcoal uppercase">View</a></div> </div> </mvt:foreach> </div> <mvt:if expr="(g.Offset OR g.NextOffset) AND (l.settings:orderhistory_list:per_page NE 0)"> <mvt:if expr="g.Offset EQ 0"> <div class="column half">&nbsp;</div> <mvt:else> <form method="post" action="&mvt:global:secure_sessionurl;" class="column half"> <input type="hidden" name="Screen" value="&mvte:global:Screen;" /> <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" /> <input type="hidden" name="SortBy" value="&mvte:global:SortBy;" /> <input type="hidden" name="Order_BillEmail" value="&mvte:global:Order_BillEmail;" /> <input type="hidden" name="Order_BillZip" value="&mvte:global:Order_BillZip;" /> <input type="hidden" name="Offset" value="&mvte:global:PrevOffset;" /> <mvt:item name="buttons" param="Previous" /> </form> </mvt:if> <mvt:if expr="g.NextOffset EQ 0"> <div class="column half">&nbsp;</div> <mvt:else> <form method="post" action="&mvt:global:secure_sessionurl;" class="column half align-right"> <input type="hidden" name="Screen" value="&mvte:global:Screen;" /> <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" /> <input type="hidden" name="SortBy" value="&mvte:global:SortBy;" /> <input type="hidden" name="Order_BillEmail" value="&mvte:global:Order_BillEmail;" /> <input type="hidden" name="Order_BillZip" value="&mvte:global:Order_BillZip;" /> <input type="hidden" name="Offset" value="&mvte:global:NextOffset;" /> <mvt:item name="buttons" param="Next" /> </form> </mvt:if> </mvt:if>
 

Basket #47499

Created: 1497557673
View "Basket #47499"
<mvt:assign name="g.price" value="3.25"/> <mvt:do name="g.low_price_formatted" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, g.price )" /> &mvt:global:low_price_formatted;
 
View "Basket #47367"
<mvt:assign name="g.cc_num_dirty" value="'44a44-5555/3333A1111-adasdsadasdas!'" /> <mvt:while expr="l.character_counter LT len(g.cc_num_dirty)"> <mvt:assign name="l.character_counter" value="l.character_counter + 1" /> <mvt:assign name="l.character" value="substring_var( g.cc_num_dirty, l.character_counter, 1 )"/> <mvt:if expr="isdigit(l.character)"> <mvt:if expr="l.digit_counter GT 0 AND l.digit_counter MOD 4 EQ 0"> <mvt:assign name="g.cc_num_clean" value="g.cc_num_clean $ '-'" /> </mvt:if> <mvt:assign name="g.cc_num_clean" value="g.cc_num_clean $ l.character" /> <mvt:assign name="l.digit_counter" value="l.digit_counter + 1" /> </mvt:if> </mvt:while> abc &mvte:global:cc_num_clean;
 

Basket #47334

Created: 1497388532
View "Basket #47334"
<mvt:do name="l.result" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, 1.25 )" />
 

Basket #47331

Created: 1497385891
View "Basket #47331"
<mvt:assign name="l.settings:basksum" value="62.95"/> <mvt:assign name="l.settings:qualifier" value="100.00"/> <hr> <mvt:eval expr="(10-5)"/> <hr> <mvt:eval expr="l.settings:qualifier - l.settings:basksum "/>
 
View "Basket #47284"
<mvt:assign name="l.settings:attributes[1]:template_code" value="'size'" /> <mvt:assign name="l.settings:attributes[1]:prompt" value="'Select a Size:'" /> <mvt:assign name="l.settings:attributes[2]:template_code" value="'color'" /> <mvt:assign name="l.settings:attributes[2]:prompt" value="'Select a Color:'" /> <mvt:assign name="l.settings:attributes[3]:template_code" value="'foo'" /> <mvt:assign name="l.settings:attributes[3]:prompt" value="'Foo Bar:'" /> <mvt:assign name="l.settings:attributes[4]:template_code" value="'baz'" /> <mvt:assign name="l.settings:attributes[4]:prompt" value="'Baz!:'" /> <mvt:assign name="g.var" value="'color'" /> POS: <mvt:eval expr="miva_array_search( l.settings:attributes, 1, l.attribute, 'l.attribute:template_code EQ \'' $ g.var $ '\'' )" /> <mvt:eval expr="l.attribute"/>
 

Basket #47045

Created: 1497013667
View "Basket #47045"
<mvt:assign name="g.foo" value="'bar'" /> &mvte:global:foo;<mvt:eval expr="2 + 2" />
 
View "Miva Template Language New Array and Sort Example"
<mvt:comment> | | By http://www.scotsscripts.com | </mvt:comment> <mvt:assign name="l.settings:list[1]:name" value="'apples'" /> <mvt:assign name="l.settings:list[1]:kind" value="'mac'" /> <mvt:assign name="l.settings:list[1]:color" value="'a'" /> <mvt:assign name="l.settings:list[2]:name" value="'bananas'" /> <mvt:assign name="l.settings:list[2]:kind" value="'South American'" /> <mvt:assign name="l.settings:list[2]:color" value="'C'" /> <mvt:assign name="l.settings:list[3]:name" value="'orange'" /> <mvt:assign name="l.settings:list[3]:kind" value="'Florida'" /> <mvt:assign name="l.settings:list[3]:color" value="'b'" /> <mvt:assign name="l.settings:list[4]:name" value="'orange'" /> <mvt:assign name="l.settings:list[4]:kind" value="'Michigan'" /> <mvt:assign name="l.settings:list[4]:color" value="'d'" /> <h2>Before</h2> <mvt:foreach iterator="item" array="list"> name: &mvt:item:name;<br> kind: &mvt:item:kind;<br> color: &mvt:item:color;<br> <hr/> </mvt:foreach> <mvt:comment> | | while loop to create new array and add colorsort field | </mvt:comment> <mvt:assign name="l.elements" value="miva_array_elements(l.settings:list)" /> <mvt:while expr="l.counter LT l.elements"> <mvt:assign name="l.counter" value="l.counter + 1" /> <mvt:assign name="l.struct" value="l.settings:list[l.counter]" /> <mvt:assign name="l.struct:colorsort" value="toupper(l.struct:color)" /> <mvt:assign name="l.success" value="miva_array_insert( l.settings:newlist, l.struct, -1 )" /> </mvt:while> <mvt:comment> | |copy new array to original, sort, and display new list | </mvt:comment> <mvt:assign name="l.settings:list" value="l.settings:newlist" /> <mvt:do file="g.module_library_utilities" name="l.success" value="QuickSortArray(l.settings:list,':colorsort', 1)" /> <h2>After Sort</h2> <mvt:foreach iterator="item" array="list"> name: &mvt:item:name;<br> kind: &mvt:item:kind;<br> color: &mvt:item:color;<br> colorSort: &mvt:item:colorSort; <hr/> </mvt:foreach>
 

Basket #46929

Usage of QuickSortArray
Created: 1496956311
View "Basket #46929"
<mvt:comment> | | By http://www.scotsscripts.com | </mvt:comment> <mvt:assign name="l.settings:order[1]:id" value="'1'" /> <mvt:assign name="l.settings:order[1]:order_status" value="'In Progress'" /> <mvt:assign name="l.settings:order[2]:id" value="'2'" /> <mvt:assign name="l.settings:order[2]:order_status" value="'In Progress'" /> <mvt:assign name="l.settings:order[3]:id" value="'3'" /> <mvt:assign name="l.settings:order[3]:order_status" value="'Pending'" /> <mvt:assign name="l.settings:order[4]:id" value="'4'" /> <mvt:assign name="l.settings:order[4]:order_status" value="'In Progress'" /> <p><b>Original:</b></p> <mvt:foreach iterator="item" array="order"> id: &mvt:item:id; status: &mvt:item:order_status;<br> </mvt:foreach> <mvt:assign name="l.elements" value="miva_array_elements(l.settings:order)" /> <mvt:while expr="l.counter LT l.elements"> <mvt:assign name="l.counter" value="l.counter + 1" /> <mvt:assign name="l.struct" value="l.settings:order[l.counter]" /> <mvt:if expr="tolower(l.struct:order_status) EQ 'pending'"> <mvt:assign name="l.struct:order_status" value="'In Progress'" /> </mvt:if> <mvt:assign name="l.success" value="miva_array_insert( l.settings:temp_array, l.struct, -1 )" /> </mvt:while> <mvt:assign name="l.settings:order" value="l.settings:temp_array" /> <p><b>Updated:</b></p> <mvt:foreach iterator="item" array="order"> id: &mvt:item:id; status: &mvt:item:order_status;<br> </mvt:foreach>
 

Basket #46923

Usage of QuickSortArray
Created: 1496950718
View "Basket #46923"
<mvt:comment> | | By http://www.scotsscripts.com | </mvt:comment> <mvt:assign name="l.settings:list[1]:name" value="'apples'" /> <mvt:assign name="l.settings:list[1]:kind" value="'mac'" /> <mvt:assign name="l.settings:list[1]:color" value="'a'" /> <mvt:assign name="l.settings:list[2]:name" value="'bananas'" /> <mvt:assign name="l.settings:list[2]:kind" value="'South American'" /> <mvt:assign name="l.settings:list[2]:color" value="'C'" /> <mvt:assign name="l.settings:list[3]:name" value="'orange'" /> <mvt:assign name="l.settings:list[3]:kind" value="'Florida'" /> <mvt:assign name="l.settings:list[3]:color" value="'b'" /> <mvt:assign name="l.settings:list[4]:name" value="'orange'" /> <mvt:assign name="l.settings:list[4]:kind" value="'Michigan'" /> <mvt:assign name="l.settings:list[4]:color" value="'d'" /> <h2>Before</h2> <mvt:foreach iterator="item" array="list"> name: &mvt:item:name;<br> kind: &mvt:item:kind;<br> color: &mvt:item:color;<br> <hr/> </mvt:foreach> <mvt:comment> | | while loop to create new array and add colorsort field | </mvt:comment> <mvt:assign name="l.elements" value="miva_array_elements(l.settings:list)" /> <mvt:while expr="l.counter LT l.elements"> <mvt:assign name="l.counter" value="l.counter + 1" /> <mvt:assign name="l.struct" value="l.settings:list[l.counter]" /> <mvt:assign name="l.struct:colorsort" value="toupper(l.struct:color)" /> <mvt:assign name="l.success" value="miva_array_insert( l.settings:newlist, l.struct, -1 )" /> </mvt:while> <mvt:comment> | |copy new array to original, sort, and display new list | </mvt:comment> <mvt:assign name="l.settings:list" value="l.settings:newlist" /> <mvt:do file="g.module_library_utilities" name="l.success" value="QuickSortArray(l.settings:list,':colorsort', -1)" /> <h2>After Sort</h2> <mvt:foreach iterator="item" array="list"> name: &mvt:item:name;<br> kind: &mvt:item:kind;<br> color: &mvt:item:color;<br> colorSort: &mvt:item:colorSort; <hr/> </mvt:foreach>
 

Basket #46831

Created: 1496886847
View "Basket #46831"
<mvt:assign name="g.foo" value="'baaar'" /> &mvte:global:foo; <mvt:while expr="g.counter LT 10"> <mvt:assign name="g.counter" value="g.counter + 1" /> &mvte:global:counter;<br> </mvt:while>
 
View "Basket #46802"
<mvt:assign name="l.settings:basket:items[1]:code" value="'doe'" /> <mvt:assign name="l.settings:basket:items[2]:code" value="'ray'" /> <mvt:assign name="l.settings:basket:items[3]:code" value="'mee'" /> <mvt:assign name="l.settings:basket:items[4]:code" value="'fah'" /> <mvt:assign name="l.settings:basket:items[5]:code" value="'soh'" /> <mvt:assign name="l.settings:basket:items[6]:code" value="'lah'" /> <mvt:assign name="l.settings:basket:items[7]:code" value="'tee'" /> <h2>Always at End</h2> <mvt:foreach iterator="item" array="basket:items"> "&mvt:item:code;", </mvt:foreach> <h2>Using POS1</h2> <mvt:foreach iterator="item" array="basket:items"> <mvt:if expr="POS1 EQ 2">,</mvt:if> "&mvt:item:code;" </mvt:foreach> <hr> &mvt:basket:items[4]:code;
 

Basket #46697

[Video Tutorial](http://www.miva.com/videos/web_developers/structures) Structures are a lot like arrays.
Created: 1496853449
View "Basket #46697"
<mvt:assign name="g.foo" value="'bar'" /> &mvte:global:foo;<mvt:assign name="g.foo" value="'bar'" /> &mvte:global:foo;<mvt:assign name="g.foo" value="'bar'" /> &mvte:global:foo;<mvt:assign name="g.foo" value="'bar'" /> &mvte:global:foo;<mvt:assign name="g.foo" value="'bar'" /> &mvte:global:foo;<mvt:assign name="l.settings:example:foo" value="'bar'" /> <mvt:assign name="l.settings:example:bar" value="'baz'" /> &mvt:example:foo;<br> &mvt:example:bar;<br> <hr> <mvt:assign name="l.settings:example:list[0]" value="'Bananas'" /> <mvt:assign name="l.settings:example:list[1]" value="'Milk'" /> <mvt:assign name="l.settings:example:list[2]" value="'Bread'" /> <mvt:assign name="l.settings:example:list[3]" value="'Cereal'" /> &mvt:example:list[0];<br> &mvt:example:list[1];<br> &mvt:example:list[2];<br> &mvt:example:list[3];<br> <br> <mvt:foreach iterator="item" array="example:list"> &mvt:item;<br> </mvt:foreach> <hr> <mvt:assign name="l.settings:example:states[0]:abbr" value="'CA'" /> <mvt:assign name="l.settings:example:states[0]:name" value="'California'" /> <mvt:assign name="l.settings:example:states[1]:abbr" value="'FL'" /> <mvt:assign name="l.settings:example:states[1]:name" value="'Florida'" /> &mvt:example:states[0]:abbr; - &mvt:example:states[0]:name;<br> &mvt:example:states[1]:abbr; - &mvt:example:states[1]:name;<br> <br> <mvt:foreach iterator="state" array="example:states"> &mvt:state:abbr; - &mvt:state:name;<br> </mvt:foreach> <hr> <h4>Print Example Structure:</h4> <mvt:eval expr="decodeattribute(glosub(miva_array_serialize(l.settings:example), ',', '<br>'))" />
 
View "Snippet: 1496699279 - v1"
<mvt:assign name="l.success" value="miva_json_decode( '[{\"state\": \"AL\", \"loc\": \"222 Street\"}, {\"state\": \"AL\", \"loc\": \"223 Street\"}, {\"state\": \"AL\", \"loc\": \"224 Street\"}, {\"state\": \"AL\", \"loc\": \"225 Street\"}, {\"state\": \"AL\", \"loc\": \"226 Street\"}, {\"state\": \"AL\", \"loc\": \"227 Street\"}, {\"state\": \"AL\", \"loc\": \"228 Street\"}, {\"state\": \"AL\", \"loc\": \"229 Street\"}, {\"state\": \"AL\", \"loc\": \"230 Street\"}, {\"state\": \"AL\", \"loc\": \"231 Street\"}, {\"state\": \"CA\", \"loc\": \"232 Street\"}, {\"state\": \"CA\", \"loc\": \"233 Street\"}, {\"state\": \"CA\", \"loc\": \"228 Street\"}, {\"state\": \"CA\", \"loc\": \"229 Street\"}, {\"state\": \"CA\", \"loc\": \"230 Street\"}, {\"state\": \"CA\", \"loc\": \"231 Street\"}, {\"state\": \"CA\", \"loc\": \"232 Street\"}, {\"state\": \"CA\", \"loc\": \"233 Street\"}]', l.settings:points )" /> <mvt:assign name="l.settings:states" value="NULL" /> <mvt:foreach iterator="point" array="points"> <mvt:assign name="l.tmp" value="NULL" /> <mvt:assign name="l.tmp:state" value="l.settings:point:state" /> <mvt:assign name="l.success" value="miva_array_insert_var( l.tmp:loc, l.settings:point:loc, -1 )" /> <mvt:assign name="l.index" value="miva_array_search( l.settings:states, 1, l.element, 'l.element:state EQ l.tmp:state' )" /> <mvt:if expr="l.index"> <h3>Operation = Updated.</h3> <mvt:assign name="l.success" value="miva_array_insert_var( l.settings:states[ l.index ]:loc, l.tmp:loc[1], -1 )" /> <mvt:else> <h3>Operation = Inserted.</h3> <mvt:assign name="l.success" value="miva_array_insert_var( l.settings:states, l.tmp, -1 )" /> </mvt:if> <hr> </mvt:foreach> <mvt:assign name="g.mvt_debug" value="glosub( miva_array_serialize( l.settings:states ), ',', asciichar( 10 ) )" /> <textarea> &mvt:global:mvt_debug; </textarea>
 

Basket #45227

Created: 1496000239
View "Basket #45227"
<h2>MivaScript MOD</h2> <p>MivaScript has a built in Modulus opperator: <code>MOD</code></p> <mvt:assign name="l.settings:mod" value="3 MOD 3" /> <code>3 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="4 MOD 3" /> <code>4 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="5 MOD 3" /> <code>5 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="6 MOD 3" /> <code>6 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="7 MOD 3" /> <code>7 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="8 MOD 3" /> <code>8 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="9 MOD 3" /> <code>9 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="5.1 MOD 1" /> <code>5.1 MOD 1</code> = &mvte:mod;<br/>
 
View "MOD examples"
<h2>MivaScript MOD</h2> <p>MivaScript has a built in Modulus operator: <code>MOD</code></p> <mvt:assign name="l.settings:mod" value="1 MOD 3" /> <code>1 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="2 MOD 3" /> <code>2 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="3 MOD 3" /> <code>3 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="4 MOD 3" /> <code>4 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="5 MOD 3" /> <code>5 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="6 MOD 3" /> <code>6 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="7 MOD 3" /> <code>7 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="8 MOD 3" /> <code>8 MOD 3</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="9 MOD 3" /> <code>9 MOD 3</code> = &mvte:mod;<br/><br/> <mvt:assign name="l.settings:mod" value="1 MOD 4" /> <code>1 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="2 MOD 4" /> <code>2 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="3 MOD 4" /> <code>3 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="4 MOD 4" /> <code>4 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="5 MOD 4" /> <code>5 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="6 MOD 4" /> <code>6 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="7 MOD 4" /> <code>7 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="8 MOD 4" /> <code>8 MOD 4</code> = &mvte:mod;<br/> <mvt:assign name="l.settings:mod" value="9 MOD 4" /> <code>9 MOD 4</code> = &mvte:mod;<br/><br/>
 
View "Basket #45052"
<mvt:if expr="slice CIN the whole pie; slice plus all the other slices"> true <mvt:else> false </mvt:if>
 
View "Is_Numeric / Float Detection"
<h2>Background / Abount</h2> <p>I wasn't able to find a way to easily check whether or not a value was a Float or not. <code>isdigit()</code> didn't work, so I tried this logic. <h2>Sample <code>isdigit()</code> with Floats</h2> isdigit(1) = <mvt:eval expr="isdigit(1)" /><br/> isdigit(3.14) = <mvt:eval expr="isdigit(3.14)" /><br/> <mvt:if expr="NOT isdigit(3.14)"> <blockquote>3.14 is not a digit</blockquote> </mvt:if> <h2>Is_Numeric Logic &amp; Cases</h2> <mvt:assign name="l.settings:tests" value="miva_array_deserialize('-2,-1.5,-1,-0.5,0,000.000,0.5,1,1.5,2,3.14159,111111111,,000000-,-,!,@,#,$,%,^,a,b,c,d,-1.b,u.3' )" /> <mvt:foreach iterator="test" array="tests"> <mvt:if expr="len(l.settings:test) AND (l.settings:test EQ 0 OR l.settings:test/l.settings:test EQ 1)"> <mvt:assign name="l.settings:color" value="'green'" /> <mvt:assign name="l.settings:result" value="'PASS'" /> <mvt:else> <mvt:assign name="l.settings:color" value="'red'" /> <mvt:assign name="l.settings:result" value="'FAIL'" /> </mvt:if> <h2 style="color: &mvt:color;"><code>&mvt:result;: "&mvt:test;"</code></h2> <mvt:comment> <mvt:assign name="l.len" value="len(l.settings:test)" /> <mvt:assign name="l.index" value="1" /> <mvt:while expr="l.index LE l.len"> <mvt:assign name="l.settings:char" value="substring( l.settings:test, l.index, 1 )" /> &mvt:char;<br> <mvt:assign name="l.index" value="l.index + 1" /> </mvt:while> </mvt:comment> </mvt:foreach>