Hello,
I have some code that will allow search for a value entered in a form in a field of a database. The name of this field is: “work_field”.
In my database, I have actually three fields like: “work_field0”, “work_field1” and “work_field2”.
How can I modify this code so that research is done in four fields “work_field”, “work_field0”, “work_field1” and “work_field2”?
thank you
[php]if(GetLookupTable(“work_field”, $strTableName))
$pageObject->settingsMap[“globalSettings”][‘shortTNames’][GetLookupTable(“work_field”, $strTableName)] = GetTableURL(GetLookupTable(“work_field”, $strTableName));
$pageObject->fillFieldToolTips(“work_field”);
$srchFields = $pageObject->searchClauseObj->getSearchCtrlParams(“work_field”);
$firstFieldParams = array();
if (count($srchFields))
{
$firstFieldParams = $srchFields[0];
}
else
{
$firstFieldParams[‘fName’] = “work_field”;
$firstFieldParams[‘eType’] = ‘’;
$firstFieldParams[‘value1’] = ‘’;
$firstFieldParams[‘opt’] = ‘’;
$firstFieldParams[‘value2’] = ‘’;
$firstFieldParams[‘not’] = false;
}
// create control
$ctrlBlockArr = $searchControlBuilder->buildSearchCtrlBlockArr($id, $firstFieldParams[‘fName’], 0, $firstFieldParams[‘opt’], $firstFieldParams[‘not’], false, $firstFieldParams[‘value1’], $firstFieldParams[‘value2’]);
if(isEnableSection508())
$xt->assign_section(“work_field_label”,"<label for="".GetInputElementId(“work_field”, $id)."">","");
else
$xt->assign(“work_field_label”, true);
$xt->assign(“work_field_fieldblock”, true);
$xt->assignbyref(“work_field_editcontrol”, $ctrlBlockArr[‘searchcontrol’]);
$xt->assign(“work_field_notbox”, $ctrlBlockArr[‘notbox’]);
// create second control, if need it
$xt->assignbyref(“work_field_editcontrol1”, $ctrlBlockArr[‘searchcontrol1’]);
// create search type select
$xt->assign(“searchtype_work_field”, $ctrlBlockArr[‘searchtype’]);
$isFieldNeedSecCtrl = $searchControlBuilder->isNeedSecondCtrl(“work_field”);
$ctrlInd = 0;
if ($isFieldNeedSecCtrl)
{
$pageObject->controlsMap[“search”][“searchBlocks”][] = array(‘fName’=>“work_field”, ‘recId’=>$id, ‘ctrlsMap’=>array(0=>$ctrlInd, 1=>($ctrlInd+1)));
$ctrlInd+=2;
}
else
{
$pageObject->controlsMap[“search”][“searchBlocks”][] = array(‘fName’=>“work_field”, ‘recId’=>$id, ‘ctrlsMap’=>array(0=>$ctrlInd));
$ctrlInd++;
}[/php]