| Author |
Message |
Emir_W
Senior Member
Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
|

Topic: Parameter as XML Posted: 13 Feb 2011 at 12:04am |
|
Dear all,
I'm using CR XI. And almost all the reports are using XML params which will printed from the application (programmed using Dexterity done by previous programmer).
Now I'am creating new report and using XML params. When I add an XML as parameter (same as the existing report) it gives me message "The ')' is missing".
And the error came from a variable 'DTFrom' which is
'From Date : ' + ToText(Cdate(XmlRetrieveTag ({?@ids}, 'Fromdate')),'dd/MM/yyyy')
The error pointing to 'XmlRetrieveTag'.
Here is the params: <Root><Parameters Fromdate='01/01/2009' Todate='12/31/2009' Status='0' ></Parameters></Root>
But if I open the other report, with XML params, it working fine. I can run the report without any error.
Question is: Why I got an error message in my report? Am I missing some steps?
EW
|
|
Emir W
|
IP Logged |
|
|
|
Emir_W
Senior Member
Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
|

Posted: 30 Mar 2011 at 2:01am |
|
sorry for late to update... i got the answer..
there is a function that been created by prev programmer. and this function should be exist in each report which use this function.
here are the steps how to add a function in a report:
- open formula editor
in the left side there is a section called 'Report Custom Functions'
- put your function script in here
hope it useful
Edited by Emir_W - 30 Mar 2011 at 2:07am
|
|
Emir W
|
IP Logged |
|
reacha
Newbie
Joined: 02 Nov 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 27 Jun 2012 at 4:17am |
Can you please share the script that you have used in the report custom functions. I have one report which is taking xml as an input parameter, not sure how that really works. Thanks,
|
|
Thanks,
reacha
|
IP Logged |
|
Emir_W
Senior Member
Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
|

Posted: 27 Jun 2012 at 7:39pm |
|
Hi,
Here is the function that I have (using Basic Syntax). Just follow the steps that I've mentioned before.
Remember, this function should be added on each report which use XML format for parameter(s).
------------------- Function XmlRetrieveTag (ids As String, Parameter as String) As String if InStr(ids, Parameter) > 0 then XmlRetrieveTag = Mid (ids, InStr(ids, Parameter), length(ids) - InStr(ids, Parameter)) if Instr(Mid (XmlRetrieveTag, InStr(XmlRetrieveTag, "=") + 2, length(XmlRetrieveTag)), chr(39))-1 > 0 then XmlRetrieveTag = Mid (XmlRetrieveTag, InStr(XmlRetrieveTag, "=") + 2, Instr(Mid (XmlRetrieveTag, InStr(XmlRetrieveTag, "=") + 2, length(XmlRetrieveTag)), chr(39)) - 1) else XmlRetrieveTag = "" end if else XmlRetrieveTag = "" end if End Function -------------------
Note: in my case, inside CR there is no 'Selection Record' need to mention. because all came from Stored Procedure (SP) that we've created in MS-SQL. so, when we attach the SP to CR it will run the parameter(s) from SP (which is in XML format).
here is an example params when I run one of the CR. it will ask me a param asking for 'Year', 'Date to', and Counter/Switch (incunpst = include posted data or not or both). <Root><Parameters year='2008' dt_to='03/31/2008' incunpst='3'></Parameters></Root>
hope it help.
Edited by Emir_W - 27 Jun 2012 at 7:47pm
|
|
Emir W
|
IP Logged |
|
reacha
Newbie
Joined: 02 Nov 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 20 Jul 2012 at 3:53am |
I have a report which is taking xml as input parameter but the end user may not like to enter the xml code in the parameter. Is there any way to convert that xml parameter input to drop down list parameter in crystal reports?
Edited by reacha - 20 Jul 2012 at 3:53am
|
|
Thanks,
reacha
|
IP Logged |
|
Emir_W
Senior Member
Joined: 25 Apr 2010
Online Status: Offline
Posts: 228
|

Posted: 20 Jul 2012 at 11:06am |
|
in this case, you can create a script in VB or other (.net). just create an input and put the result in XML format. then, pass this xml to CR report. that's the logic.
hope it help.
|
|
Emir W
|
IP Logged |
|
reacha
Newbie
Joined: 02 Nov 2010
Location: United States
Online Status: Offline
Posts: 7
|

Posted: 20 Jul 2012 at 11:16am |
I dont think the vb code works but i want to code in the crystal formula something which can convert the list of values to xml by adding all the tags. Thanks
|
|
Thanks,
reacha
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 23 Jul 2012 at 7:34am |
so it sounds like the parameter is not xml, as a user would never type xml. sounds like you want to send multiple values to the database to select with... if you have a list of values, why do you need to convert to xml? to send to db for a stored proc? why? Why not just filter what comes back via the Report\selection formula\record? Agreed, rather have the data filtered on the db, but CR doesn't give the option (that I know of) to convert the parameters prior to using them. You would need a clever way for the user to simply enter them and then have the DB convert them, at which point, you are probably getting diminishing returns as there are existing methods to assist you. Just wondering as your criteria doesn't seem to match with Emir_W's solution.
|
IP Logged |
|
|
|