Standard |
Module1 |
Filter_Additional_Info |
Basic |
filter_with_macros_2|listbox1 (Control) filter_with_macros_2|listbox2 (Control) |
25 |
SUB Filter_Additional_Info(oEvent AS OBJECT) DIM oDoc AS OBJECT DIM oDrawpage AS OBJECT DIM oForm1 AS OBJECT DIM oForm2 AS OBJECT DIM stTag AS String stTag = oEvent.Source.Model.Tag arList() = Split(stTag, ",") oDoc=thisComponent oDrawpage=oDoc.drawpage oForm1=oDrawpage.forms.getByName("filter") oForm2=oDrawpage.forms.getByName("display") FOR i = LBound(arList()) TO UBound(arList()) IF i = 0 THEN oForm1.getByName(arList(i)).commit() oForm1.updateRow() ELSE oForm1.getByName(arList(i)).refresh() END IF NEXT oForm2.reload() END SUB |
Standard |
Module1 |
Hierarchical_Control |
Basic |
hierarchical_macrofilter|listbox4 (Control) hierarchical_macrofilter|listbox3 (Control) hierarchical_macrofilter|listbox2 (Control) hierarchical_macrofilter|listbox1 (Control) searchtable_hierarchical_macrofilter_form_directly_filtered|listbox4 (Control) searchtable_hierarchical_macrofilter_form_directly_filtered|listbox3 (Control) searchtable_hierarchical_macrofilter_form_directly_filtered|listbox2 (Control) searchtable_hierarchical_macrofilter_form_directly_filtered|listbox1 (Control) |
89 |
SUB Hierarchical_Control(oEvent AS OBJECT) DIM oDoc AS OBJECT DIM oDrawpage AS OBJECT DIM oForm AS OBJECT DIM oFieldHidden AS OBJECT DIM oField AS OBJECT DIM oField1 AS OBJECT DIM oField2 AS OBJECT DIM stSql AS STRING DIM arContent() DIM stTag AS STRING oField = oEvent.Source.Model stTag = oField.Tag oForm = oField.Parent aFilter() = Split(stTag, ",") stFilter = "" IF Trim(aFilter(1)) = "" THEN IF oField.getCurrentValue <>"" THEN stFilter = """"+Trim(aFilter(0))+"""='"+oField.getCurrentValue()+"'" IF oForm.Filter <> "" AND InStr(oForm.Filter, """"+Trim(aFilter(0))+"""='") = 0 THEN stFilter = oForm.Filter + " AND " + stFilter ELSEIF oForm.Filter <> "" THEN stFilter = Left(oForm.Filter, InStr(oForm.Filter, """"+Trim(aFilter(0))+"""='")-1) + stFilter END IF END IF oForm.Filter = stFilter oForm.reload() ELSE oFieldHidden = oForm.getByName(Trim(aFilter(1))) IF oField.getCurrentValue <>"" THEN stFilter = """"+Trim(aFilter(0))+"""='"+oField.getCurrentValue()+"'" IF oFieldHidden.HiddenValue <> "" AND InStr(oFieldHidden.HiddenValue, """"+Trim(aFilter(0))+"""='") = 0 THEN stFilter = oFieldHidden.HiddenValue + " AND " + stFilter ELSEIF oFieldHidden.HiddenValue <> "" THEN stFilter = Left(oFieldHidden.HiddenValue, InStr(oFieldHidden.HiddenValue, """"+Trim(aFilter(0))+"""='")-1) + stFilter END IF END IF oFieldHidden.HiddenValue = stFilter END IF IF UBound(aFilter()) > 1 THEN oField1 = oForm.getByName(Trim(aFilter(2))) aFilter1() = Split(oField1.Tag,",") IF oField.getCurrentValue <>"" THEN stSql = "SELECT DISTINCT """+Trim(aFilter1(0))+""" FROM """+oForm.Command+""" WHERE "+stFilter+" ORDER BY """+Trim(aFilter1(0))+"""" oDatasource = ThisComponent.Parent.CurrentController If NOT (oDatasource.isConnected()) THEN oDatasource.connect() END IF oConnection = oDatasource.ActiveConnection() oSQL_Command = oConnection.createStatement() oResult = oSQL_Command.executeQuery(stSql) inCounter = 0 WHILE oResult.next ReDim Preserve arContent(inCounter) arContent(inCounter) = oResult.getString(1) inCounter = inCounter+1 WEND ELSE arContent(0) = "" END IF oField1.StringItemList = arContent() oField1.refresh() WHILE UBound(aFilter1()) > 1 DIM aEmpty() oField2 = oForm.getByName(Trim(aFilter1(2))) DIM aFilter1() aFilter1() = Split(oField2.Tag,",") oField2.StringItemList = aEmpty() oField2.refresh() WEND END IF END SUB |