From ed717d7673cefd4f35525e64034a16b8eddf359d Mon Sep 17 00:00:00 2001 From: Alex Hellier Date: Tue, 3 Sep 2013 14:09:45 +0100 Subject: [PATCH 1/5] added compareLists compare listA vs listB for allowed values --- Functions/bobspadger/compareLists.fmfn | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Functions/bobspadger/compareLists.fmfn diff --git a/Functions/bobspadger/compareLists.fmfn b/Functions/bobspadger/compareLists.fmfn new file mode 100644 index 0000000..a42402e --- /dev/null +++ b/Functions/bobspadger/compareLists.fmfn @@ -0,0 +1,30 @@ +/* + * 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 + * + */ + +Let ( [ +~allowed = allowedList ; +~selected =selectedList ; +~compare = Filter ( ~selected ; ~allowed ) +] ; +If ( ~compare = ~selected ; "match" ; "notmatch" ) +) \ No newline at end of file From 0cc47a7162d324419f8d59a55ce60b5e80da9a95 Mon Sep 17 00:00:00 2001 From: Alex Hellier Date: Thu, 2 Jan 2014 19:51:39 +0000 Subject: [PATCH 2/5] added in contact details to custom function --- Functions/bobspadger/compareLists.fmfn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Functions/bobspadger/compareLists.fmfn b/Functions/bobspadger/compareLists.fmfn index a42402e..f3fda90 100644 --- a/Functions/bobspadger/compareLists.fmfn +++ b/Functions/bobspadger/compareLists.fmfn @@ -17,7 +17,8 @@ * * 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 + * RELEASE: 2013-09-03 + * alex(AT)absolutemusic.co.uk * */ From 98c39e3d06c1693b0ecdec22d9ff7ed117e521da Mon Sep 17 00:00:00 2001 From: Alex Hellier Date: Fri, 3 Jan 2014 09:27:43 +0000 Subject: [PATCH 3/5] updated from the live copy in FM to give boolean output --- Functions/bobspadger/compareLists.fmfn | 9 +++++++-- Standards.fmp12 | Bin 409600 -> 409600 bytes 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Functions/bobspadger/compareLists.fmfn b/Functions/bobspadger/compareLists.fmfn index f3fda90..4dd81ea 100644 --- a/Functions/bobspadger/compareLists.fmfn +++ b/Functions/bobspadger/compareLists.fmfn @@ -22,10 +22,15 @@ * */ +// 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 ; "match" ; "notmatch" ) -) \ No newline at end of file +If ( ~compare = ~selected ; "1" ; "0" ) +) + +// 1 = two lists match 0 = they are different diff --git a/Standards.fmp12 b/Standards.fmp12 index 02819aff947d9ec8504906ad31006dd12ce898af..46817e1513503e0f78d97121b7f475b4398717e7 100644 GIT binary patch delta 770 zcmZWnT}V_x6rMA8X71fh_TJsSuC5y~OBpWh>ayu-ZRkir`5^fgE(Mwr;Sv#;$eKA3 zVJ}K{A1*;uP!K{$wCJTLp@&|2P?Fwz^d-<2A+VphcMJM?nBmMh-}%0C<{T-LQYK#; z1}-mq>0@M1d(#lH8Qw;y{L-=cNf6F?eiSrkil4I~7H;cG^=3<*C;ED;m8+8z+3QQ` zQ$U?>{7e{(O0_aEIW}2YN*8K3)6Q++c+rV$!m2tkYqq_xA$e*MH>R?hX^1>^C??VG{m8bNN~qVXQ{gn1-4fA&}^yL z@ykUSOB_VlPl_vl*bmfG+y}d~cMbsx|Zk-s}s$ylnS{{qhL^OW`H`0ze}H@-(rqiIzA%4xMuZ`DY~dDNeq`kvhCAvQ#s u8*MAL6<@R$a5%OVGyRu>L(aQKSQ48p{t{*(C$zxu78n~2dAh~EcKigDJD&^y delta 382 zcmW-d%_~Gv0L9&V*t{XWs4Cs_(G=bjri(tqiI@C1hR# Date: Fri, 3 Jan 2014 09:39:55 +0000 Subject: [PATCH 4/5] error in the info --- Functions/bobspadger/compareLists.fmfn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Functions/bobspadger/compareLists.fmfn b/Functions/bobspadger/compareLists.fmfn index 4dd81ea..b08fe58 100644 --- a/Functions/bobspadger/compareLists.fmfn +++ b/Functions/bobspadger/compareLists.fmfn @@ -33,4 +33,4 @@ Let ( [ If ( ~compare = ~selected ; "1" ; "0" ) ) -// 1 = two lists match 0 = they are different +// 1 = two lists differ 0 = they are the same From 80dcc0aca6c3aea2cbba84e2404b2127d3c0ef1b Mon Sep 17 00:00:00 2001 From: Alex Hellier Date: Mon, 13 Jan 2014 16:14:26 +0000 Subject: [PATCH 5/5] added ListValues --- Functions/bobspadger/ListValues.fmfn | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Functions/bobspadger/ListValues.fmfn 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