diff --git a/Functions/bobspadger/ListValues.fmfn b/Functions/bobspadger/ListValues.fmfn new file mode 100644 index 0000000..cde33c9 --- /dev/null +++ b/Functions/bobspadger/ListValues.fmfn @@ -0,0 +1,44 @@ +/* +ListValues ( Field ) +2011.06.28, Koji Takeuchi + + +description: + Return return separated value of Field data in current found set. +ex. + nameLast = "Shin" on record 1, "Koji" on record 2, "Kazuhiko" on record 3, "" on Record 4, "Satsuki" on record 5, "Kaori" on record 6 + + ListValues ( nameFirst ) + -> "Shin¶Koji¶Kazuhiko¶¶Satsuki¶Kaori" + http://www.briandunning.com/cf/1323 +*/ + +Let ( +[ +$$ListValues_total_count = + Case ( IsEmpty ( $$ListValues_total_count ) ; Get ( FoundCount ) ; $$ListValues_total_count ) ; +$$ListValues_current_count = + Case ( IsEmpty ( $$ListValues_current_count ) ; 1 ; $$ListValues_current_count + 1 ) ; +$$ListValues_value = + Case ( $$ListValues_current_count > 1 ; $$ListValues_value & "¶" ) & + GetNthRecord ( Field ; $$ListValues_current_count ) +] ; + +Case ( +// If $$ListValues_current_count is not reach to $$ListValues_total_count, call this function recursively. +$$ListValues_current_count < $$ListValues_total_count ; +ListValues ( Field ) ; + +// Otherwise, clean up $$variable and return result. +Let ( +[ +result = $$ListValues_value ; +$$ListValues_total_count = "" ; +$$ListValues_current_count = "" ; +$$ListValues_value = "" +] ; +result +) // Let +) // Case + +) // Let \ No newline at end of file diff --git a/Functions/bobspadger/compareLists.fmfn b/Functions/bobspadger/compareLists.fmfn new file mode 100644 index 0000000..b08fe58 --- /dev/null +++ b/Functions/bobspadger/compareLists.fmfn @@ -0,0 +1,36 @@ +/* + * compareLists ( allowedList ; selectedList ) + * + * PURPOSE: + * Compare the contents of a list against a second list of accepted values (example listA contains 1 2 4 which are allowed values , listB contains 2 3 4 - this will result in nomatch as 3 is not allowed as per listA) + * + * + * PARAMETERS: + * allowedList - a list of values + * selectedList - a list of values + * + * RETURNS: + * match = values in selectedList are permissible + * nomatch = value(s) in selectedList are not permissible + * + * NOTES: + * + * designed to compare magento Store ID's for products - ie , is the product in listA allowed by the possible store views + * + * RELEASE: 2013-09-03 + * alex(AT)absolutemusic.co.uk + * + */ + +// compare two lists together to see if the values in the ~selected are available in the ~allowed. Example use is for checking that the stores selected for magento are an allowed combination for the websites which are selected. + + +Let ( [ +~allowed = allowedList ; +~selected =selectedList ; +~compare = Filter ( ~selected ; ~allowed ) +] ; +If ( ~compare = ~selected ; "1" ; "0" ) +) + +// 1 = two lists differ 0 = they are the same diff --git a/Standards.fmp12 b/Standards.fmp12 index 02819af..46817e1 100644 Binary files a/Standards.fmp12 and b/Standards.fmp12 differ