Filter data excel with ilogic

Filter data excel with ilogic

jplujan
Advocate Advocate
792 Views
1 Reply
Message 1 of 2

Filter data excel with ilogic

jplujan
Advocate
Advocate

 

Hello:

I have an excel sheet with some data of bombs of which I want to filter by model I am trying to filter by models from ilogic and that I give them in an input box.
I do not know if it could be done with ilogic or you have to do it from excel with vb.net.

Attached image of the excel sheet

The field for which I want to filter would be "Family".

Thanks in advance

 

 

Dim filtro As New ArrayList
 
For fila = 1 To 200
	If (GoExcel.CellValue("A" & fila) = "") Then
		Dim Referencia As String = GoExcel.CellValue("A" & fila - 1)
		Dim Modelo As String =  GoExcel.CellValue("B" & fila- 1)
		filtro.add(referencia & Modelo)
		
	End If
	
Next
MultiValue.List("ReferenciasBombas") = filtro

myMatDescription = InputListBox("Select from the list", filtro, filtro.Item(0), "iLogic", "Available Materials")

Filtro en excel.png

0 Likes
Accepted solutions (1)
793 Views
1 Reply
Reply (1)
Message 2 of 2

jplujan
Advocate
Advocate
Accepted solution

Hello again

I leave the code with the solution in case someone could be worth it.

I admit any improvement in the code.

Thank you

 

AddVbRule "clsconfig"

Sub Main()
	itrigger = sModeloBomba

	Dim oExcel as New clsconfig
	Dim Archivo As String = oExcel.FicheroExcel 
	Dim Hoja As String = oExcel.HojaBD
	
	Call ListadoElementos(Archivo, Hoja, sModeloBomba)

End Sub


Sub ListadoElementos (ArchivoExcel as String, HojaDatos As String, ModeloBomba As String)
	Dim ListaModelos as New ArrayList
	Dim Filtro As New ArrayList
	
	GoExcel.Open(ArchivoExcel, HojaDatos)
	
	For fila = 1 To 200
			Dim UltimaReferencia As String = GoExcel.CellValue("A" & fila + 1)
			Dim UltimoModelo As String =  GoExcel.CellValue("B" & fila + 1)
			ListaModelos.add (UltimaReferencia & "," &   UltimoModelo)
	Next
		
	For Each i In ListaModelos
			Dim cadena As String = i
			Dim modelo () = cadena.split(",")
			If  String.equals (modelo(1), ModeloBomba.toUpper) Then
				filtro.add(modelo(0))
			End If
	Next
	
	MultiValue.List("ReferenciasBombas") = filtro

	'myMatDescription = InputListBox("Select from the list", listaModelos, listaModelos.Item(0), "iLogic", "Available Materials")


End Sub

Clase clsConfig

 

' clsConfig

'Utiliza una hoja de excel como base de informacion

Public Class clsConfig
	' Excel
	Public FicheroExcel As String
	Public HojaBD As String
	Public HojaDPL As String
	Public HojaPico As String
	Public HojaSD As String

 	Sub Main
	
	End Sub
 
	Public Sub New()
		'Dim Ruta As String = ThisDoc.Path
		FicheroExcel = "N:\PROY EXT\DELINEACIÓN\INVENTOR\CFG INV2012\CONFIGURACION ENTORNO\Reglas\Gestor\Bombas Wilo.xlsx"
		
		
		' Base de Datos
		HojaBD = "BD"
		HojaDPL = "DPL"
		HojaPico = "Pico"
		HojaSD = "SD"
		
	End Sub

	
End Class
0 Likes