我们有一个Web表单,允许用户从对话框列表中选择搜索选择条件。我们遇到的问题是,如果用户选择具有破折号值的functionalArea,则搜索不会返回正确的值。
作为一个例子,所选择的functionalArea可能是"工程 - 电气"但返回的值是"工程 - 制造"。 以下是表格的详细信息。谁能告诉我如何解决这个问题?
提前感谢您的帮助和意见。
让
详情如下:
我们有一个Web表单,其中包含三个用于用户输入的字段。
locationInterest字段 - 用户可以从对话框列表中选择位置值。
functionalArea字段 - 用户可以从对话框列表中选择一个函数值。 ref field - 用户可以输入参考号。
用户可以在查询搜索的其中一个字段中输入值,查询搜索的两个值或查询搜索的三个值。选择值后,用户按下“搜索”按钮。
以下是我们为搜索按钮设置的公式:
functionalAreaValue := @If(functionalArea = "Maintenance - Lift Truck"; "Service - Technicians"; functionalArea);
locationOnly := "FIELD location=" + locationInterest;
functionOnly := @If(functionalArea = "Maintenance - Lift Truck"; "FIELD functionalArea2=" + "Service - Technicians"; "FIELD functionalArea=" + functionalArea);
positionOnly := "FIELD ref=" + positionValue + "*";
locPosOnly := "FIELD location="+ locationInterest + " AND FIELD ref="+positionValue +"*";
funPosOnly := @If(functionalArea = "Maintenance - Lift Truck"; "FIELD functionalArea2=" + "Service - Technicians" + " AND FIELD ref=" + positionValue + "*"; "FIELD functionalArea=" + functionalArea + " AND FIELD ref=" + positionValue + "*");
funlocOnly := "FIELD location=" + locationInterest + " AND FIELD functionalArea=" + functionalAreaValue;
both := "FIELD location=" + locationInterest + " AND FIELD functionalArea=" + functionalAreaValue + " AND FIELD ref=" +positionValue + "*" ;
Query := @If(
locationInterest != "" & functionalAreaValue = "---Please Select Functional Area---" & positionValue = "" ; locationOnly;
functionalAreaValue != "---Please Select Functional Area---" & locationInterest = "---Please Select Location---" & positionValue = ""; functionOnly;
locationInterest ="---Please Select Location---" & functionalAreaValue = "---Please Select Functional Area---" & positionValue != "";positionOnly;
locationInterest !="---Please Select Location---" & functionalAreaValue = "---Please Select Functional Area---" & positionValue != "";locPosOnly;
locationInterest ="---Please Select Location---" & functionalAreaValue != "---Please Select Functional Area---" & positionValue != "";funPosOnly;
locationInterest !="---Please Select Location---" & functionalAreaValue != "---Please Select Functional Area---" & positionValue = "";funlocOnly;
both);
@URLOpen ("https://server.com/dbname/v.webopen?searchview&searchorder=4&query=" + Query)
答案 0 :(得分:1)
不要搜索
FIELD functionalArea2=Engineering - Electrical
但是
FIELD functionalArea2="Engineering - Electrical"
您必须将搜索字符串包含在引号中。否则搜索将分别对每个单词起作用,“ - ”表示不。
第一个代码版本将在字段functionalArea2中查找具有单词“Engineering”但不包含单词“Electrical”的文档。
第二个版本(带引号)仅返回在functionalArea2字段中具有整个字符串“Engineering - Electrical”的文档。
你的公式会是这样的
... "FIELD functionalArea2=\"" + "Engineering - Electrical" + "\"" ...
或
... {FIELD functionalArea2="} + {Engineering - Electrical} + {"} ...