Hi All!
I’m having a problem loading a file in a folder with an “Ampersand” “&” in the Name. Is there a way to solve it? Thanks
Hi All!
I’m having a problem loading a file in a folder with an “Ampersand” “&” in the Name. Is there a way to solve it? Thanks
[quote=239172:@Gerardo García]Hi All!
I’m having a problem loading a file in a folder with an “Ampersand” “&” in the Name. Is there a way to solve it? Thanks[/quote]
what O/S, version, what version of Xojo?
And what code have you tried?
We can’t debug code in your head!
Thats the code that I’m running, I parse each folder. So If a folder has X or Y number of XML files this will be added to a MySQL database.
But If the the folder has subfolder and subfolder has items to load, it will add it and so on.
I’m running Xojo 2015 Release 3.1on OS X.
[quote=239180:@Tim Parnell]And what code have you tried?
We can’t debug code in your head![/quote]
dim i as integer
dim t as integer
dim g as FolderItem
dim c as integer
Dim percentage As Integer
If f <> NIL then
c=f.Count
for i=1 to c
g=f.trueitem(i)
if g.directory then
//Aqui Obtiene el Nombre del DIrectorio
'Msgbox cstr(g.name)
//Decimos a la etiqueta de estatus que carpeta se encuentra procesando
winFacturasRecibidas.lblAvanceImportacion.text = "Importando Carpeta: " +cstr(g.name)
winFacturasRecibidas.lblAvanceImportacion.Refresh
//Obtenemos el procentage en numero
Percentage = (i /c)*100
winFacturasRecibidas.lblPorcentaje.text = str(Percentage)+"% Completado"
winFacturasRecibidas.lblPorcentaje.Refresh
//Establecemos los parametros para la barra de progreso
winFacturasRecibidas.Progressbar1.Maximum = c
winFacturasRecibidas.Progressbar1.Value = i
winFacturasRecibidas.Progressbar1.Refresh
CargarCarpetasRecibidas(g)
elseif g.Visible and left(g.name,1)<>"." and f.item(i).Type <> "" then
//Aqui Obtiene el Nombre del archivo dentro del folder
Dim xDocument As New XmlDocument
xDocument.LoadXml(f.item(i))
ProcessNode(xDocument.FirstChild)
GrabarCFDiRecibido(xDocument)
end if
next
else
MsgBox "No hay archivo"
Return
end if
End Sub
Why do you use cstr???
cstr in G.name?
for display the name of the file. If I use without it I give an Mismatch type Error
So are you saying that LoadXML fails if f.item(i) contains an ampersand? Can you create a simple project that demonstrates that error?
I’m working on it. But checking right I saw that my program Got an error, when this happen I download an empty XML File.
I tested changing folder’s name, and that is the issue. I gonna work on it and I tell you.
Thanks
Anyway, I re-download the XML file and Its not be imported
[quote=239207:@Gerardo García]cstr in G.name?
for display the name of the file. If I use without it I give an Mismatch type Error[/quote]
Folderitem.name is a string property so there is no point in using cstr
If you get a type mismatch then something else is going on.
Finally I catch the error.
Inspecting slowly I saw that the issue is not caused by Folder’s Name. I got an error When I’m trying to import an empty XML file.
But I solved, Now I download correctly files, and import they to the database.
Sorry and thanks