AndrewBaines
Technical User
Can anyone see what's wrong with my code -
I've modified the DHTML wizard that comes with CE to allow a user to enter parameters. The parameters have been named to provide groups and some other information.
The user enters values for parameters, with the code below executing once for each parameter or group of parameters.
On the parameter entry screen I have an IFRAME that displays all the current parameter values.
All works fine until the user moves to the next page (chooseFields.csp). At that point, the last parameter entered or modified disappears from the list. It doesn't matter what the value entered is or the type, its always the most recent entry.
The code that sets the parameters is:
set clientDoc = Session("ReportDocument"
parameters = Session("Parameters"
nameKey = Session("nameKey"
Set Val = Server.CreateObject("CrystalReports.ParameterFieldDiscreteValue"
Set NewField=Server.CreateObject ("CrystalReports.ParameterField"
for xLoop = 1 to nameKey
param = parameters(xLoop)
paramIndex = clientDoc.datadefinition.ParameterFields.find ("?" + param,1)
set oldField = clientDoc.DataDefinition.ParameterFields(paramIndex)
oldField.copyTo newField
'Remove the existing value
while NewField.CurrentValues.Count > 0
NewField.CurrentValues.Remove(0)
wend
value = Request.Form(parameters(xLoop))
'If value is empty, don't want to add the value.
if value <> "" then
value = ConvertToValidValue(oldfield, value)
Val.Value = value
NewField.CurrentValues.Add Val
end if
clientDoc.DataDefController.ParameterFieldController.Modify oldField, NewField
next
set val = nothing
set newfield = nothing
set oldfield = nothing
Set Session("ReportDocument" = clientDoc
Thanks all
Andrew Andrew Baines
Chase International
I've modified the DHTML wizard that comes with CE to allow a user to enter parameters. The parameters have been named to provide groups and some other information.
The user enters values for parameters, with the code below executing once for each parameter or group of parameters.
On the parameter entry screen I have an IFRAME that displays all the current parameter values.
All works fine until the user moves to the next page (chooseFields.csp). At that point, the last parameter entered or modified disappears from the list. It doesn't matter what the value entered is or the type, its always the most recent entry.
The code that sets the parameters is:
set clientDoc = Session("ReportDocument"
parameters = Session("Parameters"
nameKey = Session("nameKey"
Set Val = Server.CreateObject("CrystalReports.ParameterFieldDiscreteValue"
Set NewField=Server.CreateObject ("CrystalReports.ParameterField"
for xLoop = 1 to nameKey
param = parameters(xLoop)
paramIndex = clientDoc.datadefinition.ParameterFields.find ("?" + param,1)
set oldField = clientDoc.DataDefinition.ParameterFields(paramIndex)
oldField.copyTo newField
'Remove the existing value
while NewField.CurrentValues.Count > 0
NewField.CurrentValues.Remove(0)
wend
value = Request.Form(parameters(xLoop))
'If value is empty, don't want to add the value.
if value <> "" then
value = ConvertToValidValue(oldfield, value)
Val.Value = value
NewField.CurrentValues.Add Val
end if
clientDoc.DataDefController.ParameterFieldController.Modify oldField, NewField
next
set val = nothing
set newfield = nothing
set oldfield = nothing
Set Session("ReportDocument" = clientDoc
Thanks all
Andrew Andrew Baines
Chase International