Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WHY! ie dont show the table of result 1

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
428
IT
if i open firefox or edge or chrome the web return a table with result, and in IE not????

for test:


1) select tab vista territoriale
2) checkbox tutti i comuni della provioncia selezionata
3) in dropdown select Agrigento
4) click on Cerca

now the tabkle of content is show!!!

With my code usin IE, not show the table of result!!!

Option Explicit
Sub PROVA()

Dim IE As Object, T As Integer, Title As Object
Dim oHtml As HTMLDocument, post As Object

Set IE = CreateObject("internetexplorer.application")

With IE

.Visible = True
.navigate "
Do While .Busy
DoEvents
Loop

Do While .readyState <> 4
DoEvents
Loop

'CLICK SU VISTRA TERRITORIALE
.document.getElementById("tab-1").Click

'CHEKBOX TUTTI I COMUNI
.document.all("territorio")(3).Checked = True

'SELEZIONO UN ITEM PROVINCIA NEL COMBOBOX
Set Title = .document.getElementById("province-1")

'CONTO E PRENDO IL NOME DELLE PROVINCE NEL COMBOBOX
Set oHtml = .document
For Each post In oHtml.getElementById("province-1").getElementsByTagName("OPTION")
Debug.Print T & "-" & post.innerText
T = T + 1
Next

Title.selectedIndex = 105

'CLICK CERCA
.document.getElementById("btnricerca-1").Click

End With

End Sub
 
I'd imagine the issue is in RPCerca.php, which is bespoke serverside code called when you click the Cerca button. You can't fix that. I'd even go as far as suggesting that this is because the programmer(s) were not too concerned if their code worked with IE
 
accc.....
tks for the reply.
 
Strongm,
i use a power query for Excel:

let
url = " body = "territorio=procom&province=084&hid-i=POS&hid-a=2022&hid-l=it&hid-cat=POS&hid-dati=dati-form-1&hid-tavola=tavola-form-1",
Source = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/x-www-form-urlencoded;charset=UTF-8"], Content = Text.ToBinary(body) ] )),
datatable = Source[datatable],
#"Converted to Table" = Record.ToTable(datatable),
Value = #"Converted to Table"{0}[Value],
#"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"codistat", "mtot", "ftot", "totmf"}, {"codistat", "mtot", "ftot", "totmf"})
in
#"Expanded Column1"

possible to create a vb6 code for?

for provincia with Agrigento return 43 lines!
 
Tell you what, I'll get you part of the way there:

Code:
[COLOR=blue]Public Sub Example() 
    Dim url As String
    Dim JSONstring As String
    Dim body As String
    Dim oData As Object
    Dim oRow As Object
    
    url = "[URL unfurl="true"]https://demo.istat.it/app/RPCCerca.php"[/URL]
    body = "territorio=procom&province=084&hid-i=POS&hid-a=2022&hid-l=it&hid-cat=POS&hid-dati=dati-form-1&hid-tavola=tavola-form-1"
    
    With With CreateObject("MSXML2.XMLHTTP")
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]
        .setRequestHeader "charset", "UTF-8"
        .send body
        JSONstring = .responseText
    End With
 
    With CreateObject("ScriptControl")
        .Language = "JScript"
        With .Eval("(" + JSONstring + ")") [COLOR=green]' A javascript JSON object[/color]
            Set oData = .datatable.data [COLOR=green]' Point to the javascript JSON object representing the datatable's data[/color]
            For Each oRow In oData
                Debug.Print "codistat: " & oRow.codistat, "mtot: " & oRow.mtot, "ftot: " & oRow.ftot, "totmf: " & oRow.totmf
                [COLOR=green]'Debug.Print CallByName(oRow, "codistat", VbGet) ' an alternative[/color]
            Next
        End With
    End With
    
End Sub[/color]
 
> .DataTable.Data

Yep - becasue of the capitalisation. The JSON object is case sensitive. And but VB kindly insists on capitalising both words for you.

Here's a VB IDE hack that should fix the issue. Just add this sub:

Code:
[COLOR=blue]Private Sub Hack()
    Dim datatable, data
End Sub[/color]
 
strongm,
THANK YOU BRO, WISH I HAVE YOUR HEAD.. WORK PERFECTLY, NOW!!!!!

HOW MANY DOLLARS?

AS USUAL YOU HELPED ME A LOT!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top