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

Script Question

Status
Not open for further replies.

BlurredVision

Technical User
Aug 6, 2001
326
GB
I have the following code. It works if all the information is found, but if a field is null, it fails. Does anyone know how to get around this?

//Retrieve the collection of users in the Crystal Enterprise environment
var Users = IStore.Query("SELECT SI_NAME, SI_LAST_RUN_TIME, SI_DESCRIPTION, SI_UPDATE_TS FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Report'ORDER BY SI_NAME");


//Display the list of the users.
Response.Write('List of Report Information From Crystal Enterprise: <BR><BR>');
for (i=1; i <= Users.Count; i++)
{




Response.Write(Users.Item(i).Properties.Item('SI_NAME'));
Response.Write(',');
Response.Write(Users.Item(i).Properties.Item('SI_LAST_RUN_TIME'));
Response.Write(',');
Response.Write(Users.Item(i).Properties.Item('SI_UPDATE_TS'));
Response.Write(',');
Response.Write('<BR>');
}

Thanks for your time!
 
Hi,
How does it fail? Does is show 'undefined' for missing values or just not run?

[profile]
 
Do you need to check for nulls before each Response.Write?

So something like

If IsNull(Users.Item(i).Properties.Item('SI_NAME')Then
Response.Write &quot; &quot;
Else
Response.Write(Users.Item(i).Properties.Item('SI_NAME'));
End If

Don't quote me on the syntax, but its close.





Response.Write(Users.Item(i).Properties.Item('SI_NAME'));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top