Back to forum

Saving with server option through POST parameter "report", are missing some spaces

Resolved

First, congratulations on an excellent tool, I have implemented the saving of reports using a server script, everything is fine, but the POST parameter “report” is returning item names collapsed, for example:
Saved with the normal option:
“members”: [
“tema.Derechos humanos en México”,
“tema.Género y DDHH”
]
Saved from POST parameter “report”
“members”: [
“tema.DerechoshumanosenMéxico”,
“tema.GéneroyDDHH”
]
Is eating the spaces.
Can you help.

4 answers

WebDataRocks Team WebDataRocks September 13, 2018

Hello,
 
Thank you for the question.
Actually, we have checked the POST request that is sent from the tool, and it looks ok: http://take.ms/wrovo
Could you please verify your back-end code that it is not truncating the report JSON? 
 
Regards,
WebDataRocks Team

publior September 13, 2018

Thank’s for the quick response, as I described, the tool, on the save menu generate a valid JSON File, could you please send me or attach a valid handling script to run on the back-end, i am using asp classic, and this is the code:
Dim objStream
Set objStream = CreateObject(“ADODB.Stream”)
objStream.CharSet = “ISO-8859-1”
objStream.Open
objStream.WriteText request(“report”)
objStream.SaveToFile “c:\inetpub\wwwroot\webdatarocks-1.0.1\report\” & request(“archivo”) & “.json”, 2
objStream.close
Set objStream = Nothing
 
Again, thank you for all your help.

publior September 13, 2018

With your advise, i have found the solution, i post the solution for ASP Classic for those who face the same dilema.
This is the code of the handler, it executes in the server side.
The header from the Form data (POST), contains 3 key-value parameters, the first is called “name”, the second is “report”, and the third is “type”.
With the use of the below code, you can save the JSON Report structure to any file you want.
Hope this help someone.
<%
If Request.TotalBytes > 0 Then
Dim lngBytesCount
lngBytesCount = Request.TotalBytes

‘ Split every &; then every =.
Dim myJSONResponse, myJSONReport, myJSONName
myJSONResponse = Split(BytesToStr(Request.BinaryRead(lngBytesCount)),”&”)
myJSONName = Split(myJSONResponse(0),”=”)
myJSONReport = Split(myJSONResponse(1),”=”)
‘ Then write de JSON report part
Dim fs,f
set fs=Server.CreateObject(“Scripting.FileSystemObject”)
set f=fs.CreateTextFile(“c:\inetpub\wwwroot\webdatarocks-1.0.1\report\” & myJSONName(1) & “.json”, True)
f.write(myJSONReport(1))
f.close
set f=nothing
set fs=nothing
End If
Function BytesToStr(bytes)
Dim Stream
Set Stream = Server.CreateObject(“Adodb.Stream”)
Stream.Type = 1 ‘adTypeBinary
Stream.Open
Stream.Write bytes
Stream.Position = 0
Stream.Type = 2 ‘adTypeText
Stream.Charset = “iso-8859-1”
BytesToStr = Stream.ReadText
Stream.Close
Set Stream = Nothing
End Function
%>
 

WebDataRocks Team WebDataRocks September 17, 2018

Hi,
We are glad you have managed to resolve it. Thank you for posting your solution here. We suppose many of our users will find it useful.
Regards,
WebDataRocks Team

Move up