Loading a webi doc to file

ProtectedSub load_webi()

ceSession = ceSessionmgr.Logon(userid, password, aps, auth)

Try‘Create the infostore object‘##should not have servername‘##ceEnterpriseService = ceSession.GetService(“”, “InfoStore”)

ceEnterpriseService = ceSession.GetService(

“InfoStore”)‘Dim ceAppStore As CrystalDecisions.Enterprise.in

ceInfoStore =

New InfoStore(ceEnterpriseService)‘Grab specific report excluding Instances

sQuery =

“select top 10 webi.SI_ID,webi.SI_NAME,webi.SI_PARENTID, folder.SI_NAME “ & _” from CI_INFOOBJECTS webi “ & _” JOIN CI_INFOOBJECTS folder ON webi.SI_PARENTID = folder.SI_ID “ & _” where webi.SI_NAME like ‘%Recon%’ and webi.si_progid like ‘CrystalEnterprise.Webi'”

sQuery =

“select top 3 * from ci_infoobjects where SI_NAME like ‘%Report%’ and si_progid like ‘CrystalEnterprise.Webi'”‘”

sQuery =

“select top 3 * from ci_infoobjects where SI_ID = 58596”

sQuery =

“select * from ci_infoobjects where SI_NAME like ‘Stale Account’ AND si_progid like ‘CrystalEnterprise.Webi'”

ceReports = ceInfoStore.Query(sQuery)

Dim counter AsInteger

Response.Write(

“<table border =1>”)ForEach ceReport In ceReports

counter = counter + 1

Response.Write(

“<tr>”)

Response.Write(

“<td>” & counter & “</td><td>” & ceReport.Title)Dim k AsIntegerDim webicount AsInteger = ceReport.Properties.CountFor k = 1 To webicount – 1

Response.Write(

” <li>” & ceReport.Properties.Item(k).Name & ” |” & ceReport.Properties.Item(k).Value.ToString())NextForEach oItem As CrystalDecisions.Enterprise.File In ceReport.Files‘If InStr(oItem.Name, “Recon”) > 0 ThenDim index AsInteger = oItem.Name.LastIndexOf(“/”) + 1Dim FILE_NAME AsString = “C:\temp\webi\” & ceReport.Title & counter & “.wid”‘ oItem.Name.Substring(index)‘test_rdm_facttype-dim.unvDim objWriter As System.IO.StreamWriterTry‘objWriter = (New System.IO.StreamWriter(FILE_NAME))Dim buffer(oItem.Size) AsByte

oItem.CopyTo(buffer)

 

Dim fStream AsNew FileStream(FILE_NAME, FileMode.OpenOrCreate)Dim bw AsNew BinaryWriter(fStream)

 

bw.Write(buffer)

bw.Close()

fStream.Close()

Catch ex As ExceptionFinallyEndTry

Response.Write(

“<li> File Name:” & FILE_NAME & ” || value=” & oItem.Size)

Response.Write(

“<li> File path:” & oItem.Name & ” || value=” & oItem.Size)‘End IfNext

Response.Write(

“</td>””<td>” & ceReport.ObjectType.ToString & “”)‘Response.Write(“<ul>”)Dim i AsIntegerDim count AsInteger = ceReport.Properties.CountFor i = 1 To count – 1‘Response.Write(” <li>Property==” & ceReport.Properties.Item(i).Name & ” || value=” & ceReport.Properties.Item(i).Value.ToString())Next

Response.Write(

“</ul>”)

Response.Write(

“</td></tr>”)Next

Response.Write(

“</table>”)Catch ex As ExceptionEndTryEndSub

Leave a Reply

Your email address will not be published. Required fields are marked *