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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the XML "ReportLogon" info in c#

Status
Not open for further replies.

VibrantIce

Programmer
Mar 3, 2006
6
US
I'm trying to override the data source for a report that was deployed on BO XI. I have tried various permutations of the following code, and nothing works. Either the query uses the original data source or it doesn't run. The URL requires no password or username. What am I missing?

//reportLogon.UseOriginalDataSource = false;

//Yes, even THIS fails!
//reportLogon.CustomServerName=reportLogon.CustomServerName

//reportLogon.CustomServerName = GOOD_URL_PLUS_XSD;
//reportLogon.CustomServerName = GOOD_URL_MINUS_XSD;
//reportLogon.CustomServerType = CrystalDecisions.Enterprise.Desktop.CeReportServerType.ceServerTypeUserSpecified;
//reportLogon.CustomDatabaseDLLName = "crdb_xml";
//reportLogon.CustomUserName = string.Empty;
//reportLogon.CustomPassword = string.Empty;

 
I've been able to do this from C#:
Code:
    private void UpdateReportData(int id)
    {
      string query = "Select SI_ID"
        + " From CI_INFOOBJECTS "
        + " Where SI_KIND='CrystalReport'"
        + " And SI_PARENT_FOLDER =" + id.ToString();
      InfoObjects infoObjs = infoStore.Query(query);
      InfoObjects rptObj;
      for (int i = 1; i <= infoObjs.Count; i++)
      {
        query = "Select * "
          + " From CI_INFOOBJECTS "
          + " Where SI_ID = " + infoObjs[i].ID.ToString();
        rptObj = infoStore.Query(query);
        procStatus.Text = "Updating " + rptObj[1].Title;
        procStatus.Refresh();
        Report rpt = (Report) rptObj[1];
        for (int j=1; j <= rpt.ReportLogons.Count; j++)
        {
          rpt.ReportLogons[j].UseOriginalDataSource = false;
          rpt.ReportLogons[j].CustomServerName = ((ArrayList) folderInfo[baseList.SelectedIndex])[1].ToString();
          rpt.ReportLogons[j].CustomUserName = customUser.Text;
          rpt.ReportLogons[j].CustomPassword = customPW.Text;
        }
        infoStore.Commit(rptObj);        
      }
    }
It looks to me like you're not committing the updates to the InfoStore when you're done making changes. Without the commit, nothing actually gets saved.

-Dell


A computer only does what you actually told it to do - not what you thought you told it to do.
 
Dell,

Thanks. If I have time I'll look into the commit thing.
Though I never needed the commit before when using database data sources. It's just the XML data source that's giving me grief.

Also, I got an email from BO that said this method wasn't granular enough to properly update the native XML data sources. They said something about using RAS instead. I can't change the system now to add a new component like RAS. Fortunately it's a simple enough change to update the few report data sources manually in before deploying to production.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top