newbie27
asked on
modify script to export xml data into .csv/html/txt format
Hello Exports,
Can someone please assist me in making this script work to export xml data in different formats. At the moment it is only exporting data into .csv format.
I would like to have rest of the script independant to the format, I mean ideally I would want to create one function for each format, so that tomorrow if the client comes back and want some other export format I would only need to create another function without doing any more changes to the rest of the script.
Please can you look into the attached and see if this makes any sense to you.
Thanks for your help
Regards
Sam
Can someone please assist me in making this script work to export xml data in different formats. At the moment it is only exporting data into .csv format.
I would like to have rest of the script independant to the format, I mean ideally I would want to create one function for each format, so that tomorrow if the client comes back and want some other export format I would only need to create another function without doing any more changes to the rest of the script.
Please can you look into the attached and see if this makes any sense to you.
Thanks for your help
Regards
Sam
Hi Sam,
Wow, that's a big script!
I really can't tell what it does....it's a lot of code to try to make sense of without seeing it in action.
I really don't know if I will be able to help you, but if you could start by providing a sample XML file, and even a CSV output of the file after this script has run over it....I'll have a look and see if I can make sense of it.
Regards,
Rob.
Wow, that's a big script!
I really can't tell what it does....it's a lot of code to try to make sense of without seeing it in action.
I really don't know if I will be able to help you, but if you could start by providing a sample XML file, and even a CSV output of the file after this script has run over it....I'll have a look and see if I can make sense of it.
Regards,
Rob.
ASKER
Hello Rob,
Thanks for looking into this for me. I am sorry for not making it more clear, I know it is huge, I will cut short the functions which most of them are redundant in the script and post you back soon.
Thanks
Sam
Thanks for looking into this for me. I am sorry for not making it more clear, I know it is huge, I will cut short the functions which most of them are redundant in the script and post you back soon.
Thanks
Sam
ASKER
Hello Rob,
I have managed to receive comma separated ISBNLists (record Ids) and few parameter values from the asp page and then calling export_data.vbs to actually process and retrieve data for the given ids from the XML database and finally export it.
Export should be like saving the file in one of FTP folder on the server, the output format would be the users desired selection, at the moment I am trying to save it as comma separated fields in .csv format.
Please can you have a look to the attached, it is returning 11 records in fValues
Please see if this makes any sense to you
thanks for your help
sam
PS: if you please visit
http://213.253.134.6/artism/admin/list_admin.asp
click on export and to see the page where I am working ....
I have managed to receive comma separated ISBNLists (record Ids) and few parameter values from the asp page and then calling export_data.vbs to actually process and retrieve data for the given ids from the XML database and finally export it.
Export should be like saving the file in one of FTP folder on the server, the output format would be the users desired selection, at the moment I am trying to save it as comma separated fields in .csv format.
Please can you have a look to the attached, it is returning 11 records in fValues
Please see if this makes any sense to you
thanks for your help
sam
PS: if you please visit
http://213.253.134.6/artism/admin/list_admin.asp
click on export and to see the page where I am working ....
cn = 4
DBM = "artism"
SiteName ="artism"
FieldList = "ref_no,pe_rev_name,co_name,action_flag,co_group,notes"
If RemoteServer = "" Then RemoteServer = "http://213.253.134.6"
Set DataHash = CreateObject("Scripting.Dictionary")
' Chunk ISBNs into lots of say 50
parts = split(ISBNs, ",")
For i = 0 to Ubound(parts)
if (i + 1) mod cn = 0 Then
blob = blob & parts(i) & "|"
Else
blob = blob & parts(i) & ","
end if
Next
If Right(blob, 1) = "," Then blob = Left(blob, Len(blob)-1)
msg "blob=" & blob
' Get the data and store it ready for writing out
parts = split(blob, "|")
For each p in parts
xTxt = QuickSearchText("&SF1=keyword" & "&ST1=" & p & "&PL=" & cn, DBM, FieldList, NodeName, RemoteServer, IncTags)
'msg "xtxt=" & xtxt
xParts = Split(xTxt, "|")
For each xp in xParts
DataHash(XMLField(xp, "fv_ref_no", false)) = xp
Next
Next
'Now write out the divs in the correct order of course!
parts = split(ISBNs, ",")
For each p in parts
mx = DataHash(p)
'msg "mx=" & mx
Fields = Split(FieldList, ",")
For each f in Fields
fValues = fValues & XMLField(mx, "fv_"&f, False) & ":"
Next
fValues = fValues & VbCrLf
Next
msg fValues
ASKER
fValues = " please see the attached "
screen.jpg
screen.jpg
ASKER
Hello Rob,
Please can you assist me in writing correct columns into the csv file in this script ....
thanks for your help
sam
Please can you assist me in writing correct columns into the csv file in this script ....
thanks for your help
sam
OutFolder="E:\tbp\www\artism\admin\FTP\download"
OutFileName="media"
OutExtension="csv"
FieldTitle = Replace(Ucase(FieldList), ",", Separator) & VbCrLf
x = WriteFile(OutFile, FieldTitle)
'Now write out the columns in the correct order
parts = split(ISBNs, ",")
For each p in parts
mx = DataHash(p)
'msg "mx=" & mx
Fields = Split(FieldList, ",")
For each f in Fields
fValues = fValues & XMLField(mx, "fv_"&f, False) & ":"
Next
fValues = fValues & VbCrLf
Next
AppendtoFile OutFile, fValues
msg fValues`
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Rob,
Thanks for your help,
can you please look into this once you get the chance Rob?
https://www.experts-exchange.com/questions/23531069/modify-script-to-export-xml-data-into-csv-html-txt-format.html
thanks
sam
Thanks for your help,
can you please look into this once you get the chance Rob?
https://www.experts-exchange.com/questions/23531069/modify-script-to-export-xml-data-into-csv-html-txt-format.html
thanks
sam
ASKER
thanks
ASKER
Open in new window