ExportCategories |
This routine enables you to export existing codes and descriptions for category questions as XML.
Input
Parameter |
Description |
user |
Currently logged-in user as returned from Login |
xmlCatRequest |
XML string containing specification of study/questions for which details are required |
public static bool ExportCategories(UserProperties user, string xmlCatRequest, ref string xmlReport) |
Output
· True or False indicating success or failure
· xmlReport - XML string containing list of category values
The XML request must contain a list of category questions for one or more specified studies. The category details for each of the specified questions will be returned. If no questions are specified, all category questions will be returned. At least one study must be specified.
<macrostudies> <macrostudy name="DINODRUGS"> <questions> <question code="Investigator"/> <question code="Treatments"/> </questions> </macrostudy> </macrostudies> |
The schema for the above XML is as follows:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="questions"> <xs:complexType> <xs:sequence> <xs:element ref="question" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="question"> <xs:complexType> <xs:attribute name="code" use="required" type="xs:string" /> </xs:complexType> </xs:element> <xs:element name="macrostudy"> <xs:complexType> <xs:sequence> <xs:element ref="questions"/> </xs:sequence> <xs:attribute name="name" use="required" type="xs:string" /> </xs:complexType> </xs:element> <xs:element name="macrostudies"> <xs:complexType> <xs:sequence> <xs:element ref="macrostudy" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
For the above XML request string, an XML string such as the following will be returned:
<macrostudies> <macrostudy name="DINODRUGS"> <questions> <question code="Investigator"> <categories> <category code="801" value="Dr Peter Pan" active="true"/> <category code="805" value="Dr Florence Nightingale" active="true"/> <category code="813" value="Dr Robinson Crusoe" active="false"/> <category code="840" value="Dr Ivor Payne" active="true"/> </categories> </question> <question code="Treatments"> <categories> <category code="DIP" value="Diplodoctene" active="true"/> <category code="STG" value="Stegofen" active="true"/> <category code="TYR" value="Tyrannosol" active="false"/> </categories> </question> </questions> </macrostudy> </macrostudies> |
The schema for the above XML is as follows:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="questions"> <xs:complexType> <xs:sequence> <xs:element ref="question" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="question"> <xs:complexType> <xs:sequence> <xs:element ref="categories"/> </xs:sequence> <xs:attribute name="code" use="required" type="xs:string" /> </xs:complexType> </xs:element> <xs:element name="macrostudy"> <xs:complexType> <xs:sequence> <xs:element ref="questions"/> </xs:sequence> <xs:attribute name="name" use="required" type="xs:string" /> </xs:complexType> </xs:element> <xs:element name="macrostudies"> <xs:complexType> <xs:sequence> <xs:element ref="macrostudy" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="category"> <xs:complexType> <xs:attribute name="code" use="required" type="xs:string"/> <xs:attribute name="value" use="required" type="xs:string"/> <xs:attribute name="active" use="required" type="xs:boolean"/> </xs:complexType> </xs:element> <xs:element name="categories"> <xs:complexType> <xs:sequence> <xs:element ref="category" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> |
If a valid XML string is being returned, the ExportCategories function returns true. The XML output will contain only the category listings for valid studies and questions contained in the "request" string. Non-existent questions, or questions not of type category, will be ignored, as will incomplete or unrecognisable XML.
The ExportCategories function returns false if any other errors occur (such as invalid XML syntax) which prevent the return of a valid XML output string.