你得到的結果實際上是預期的行爲。當您發現自己,當您告訴FileMaker將List1除以List2時,它將每個列表投射爲一個數字,然後進行分割。這將刪除所有非數字字符並創建兩個長字符串,然後將第一個字符除以第二個字符。
您使用的是FileMaker Pro Advanced?如果是這樣,解決這個問題最簡單的方法是通過使用自定義功能,像這樣:
/*
=======================================================
MathLists ©2017 Drakeling Technologies
Created by Jeff Drake 19 Oct 2017
Parameters: list1 ; list2 ; separator
Purpose: applies the specified operator to each value in list 1 and the corresponding value in list 2, e.g.
MathLists ("100;150;200" ; "1000;1200;1500" ; "/" ; ";") = ".1;.125;.1333333333333333"
Dependencies: none
=======================================================
*/
Let ([
//CHANGE EACH LIST TO RETURN-DELIMITED.
#list1 = Substitute (list1 ; separator ; ¶) ;
#list2 = Substitute (list2 ; separator ; ¶) ;
//STORE THE MAXIMUM NUMBER OF VALUES TO PROCESS.
#maxValues = Max (ValueCount (#list1) ; ValueCount (#list2)) ;
//STORE THE ORIGINAL SEPARATOR.
$ƒMathLists = If (IsEmpty ($ƒMathLists) ; separator ; $ƒMathLists)
] ; //end define Let
Substitute (
List (
//IF THERE IS AT LEAST ONE PAIR OF VALUES REMAINING, RECURSE THE FUNCTION.
If (#maxValues > 1 ;
MathLists (LeftValues (#list1 ; #maxValues - 1) ; LeftValues (#list2 ; #maxValues - 1) ; operator ; $ƒDivideLists)) ; //end If
//DIVIDE THE nth VALUE FROM LIST 1 BY THE nth VALUE FROM LIST 2.
Evaluate (GetValue (#list1 ; #maxValues) & operator & GetValue (#list2 ; #maxValues))
) //end List
//RESTORE THE ORIGINAL SEPARATOR WHEN DONE.
; ¶ ; $ƒMathLists
) //end Substitute
//CLEAR THE ORIGINAL SEPARATOR WHEN DONE.
& Let ($ƒMathLists = "" ; "")
) //end Let
我所做的代碼可擴展的,這樣你就可以加,減,乘或除,這取決於您指定的四個運算符中。
希望有幫助!