I was updating MivaScript.com and noticed the description for glosub_array() did not contain a return value and there were other errors.
The description for the function says:
"Works like glosub(), but search and replace are arrays that are iterated through, each value in the search array found in the string is replaced by the corresponding replace array value."
Since I have never used this function I looked to the LSK figuring an example it usage would make it more clear.
Just to confirm my understanding, multiple search and replace operations are performed on the string l.field_id. In effect the script below does the same thing. Am I correct?
The description for the function says:
"Works like glosub(), but search and replace are arrays that are iterated through, each value in the search array found in the string is replaced by the corresponding replace array value."
Since I have never used this function I looked to the LSK figuring an example it usage would make it more clear.
Code:
<MvFUNCTION NAME = "AdminOrderFields_Sanitize_FieldCode" PARAMETERS = "field_id" STANDARDOUTPUTLEVEL = ""> <MvASSIGN NAME = "l.search" INDEX = 1 VALUE = ":"> <MvASSIGN NAME = "l.replace" INDEX = 1 VALUE = "_"> <MvASSIGN NAME = "l.search" INDEX = 2 VALUE = "-"> <MvASSIGN NAME = "l.replace" INDEX = 2 VALUE = "_"> <MvFUNCTIONRETURN VALUE = "{ glosub_array( l.field_id, l.search, l.replace ) }"> </MvFUNCTION>
Code:
<MvFUNCTION NAME = "AdminOrderFields_Sanitize_FieldCode" PARAMETERS = "field_id" STANDARDOUTPUTLEVEL = ""> <MvFUNCTIONRETURN VALUE = "{ glosub( glosub( l.field_id, ":", "_" ), "-", "_") }"> </MvFUNCTION>
Comment