<issue>
<issue>
is an expansion-control form that inserts the contents of
an XML expression at a particular point in the query. (Available as of
prod-9)
Syntax
<issue xml_="[XML_EXPRESSION]"/>
If the <issue>
form has contents, they are expanded and used as the
contents of the issued Macro Language element.
Alternate syntax
<issue tag_="[1010data_ELEMENT_NAME]" attrs_="[PACKAGE_OF_ATTR_VALUE_PAIRS]"/>
If the <issue>
form has contents, they are expanded and used as the
contents of the issued Macro Language element.
Attributes
xml_
- Accepts an XML expression, which can be specified either as text or as an XML
value.
If specified as text, the XML expression must be appropriately escaped (e.g.,
<issue xml_="<sort col="date" dir="down"/>"/>
).An XML value can be created using the long form of
<set>
, usually in conjunction with<quote>
. See Example: Using thexml_
attribute.In addition, certain widgets in QuickApps can set the value of a dynamic variable to an XML value. See the
xmlvalue_
attribute in class_="textbox" for an example.Note: If thexml_
attribute is specified, thetag_
andattrs_
attributes (as well as any contents of<issue>
) are ignored. tag_
- Accepts the name of a 1010data Macro Language element name.
The
tag_
attribute works in conjunction with theattrs_
attribute. attrs_
- Accepts a package value that contains attribute/value pairs for the Macro Language
element specified by the
tag_
attribute.
Example: Using the xml_
attribute
The following example is a QuickApp that uses the xml_
attribute for the
<issue>
element to insert Macro Language code within the query
associated with the grid
widget.
<base table="pub.demo.retail.item"/> <dynamic xml_val="{lst()}" this_col="" this_val=""> <do onsubmit_="add"> <let op=""> <set> <op> <quote col="{@this_col}" val="{@this_val}"> <sel value="{@col}='{@val}'"/> </quote> </op> </set> <set xml_val="{jnlst(@xml_val @op)}"/> </let> </do> <layout arrange_="h"> <layout arrange_="v"> <layout arrange_="h"> <widget class_="dropdown" value_="@this_col"> <columns/> <colord cols="name,label"/> </widget> <widget class_="text" text_="has the value" visible_="{@this_col<>''}"/> <widget class_="dropdown" value_="@this_val" require_="@this_col" invmode_="hide"> <issue xml="{@xml_val}"/> <tabu breaks="{@this_col}"> <break col="{@this_col}" sort="up"/> <tcol source="{@this_col}" fun="first"/> </tabu> </widget> <widget class_="button" type_="submit" submit_="add" text_="Add filter" visible_="{@this_col<>''}"/> <widget class_="button" type_="set" value_="@xml_val" newvalue_="{lst()}" text_="Clear" visible_="{lst_len(@xml_val)>0}"/> </layout> <widget class_="grid"> <issue xml="{@xml_val}"/> </widget> </layout> <widget label_="Ops:" class_="textbox" xmlvalue_="@xml_val"/> </layout> </dynamic>
The following shows the results of running the QuickApp and interacting with it:
In this example, each time the Add filter button is clicked, the
<do>
clause is executed. The <do>
clause builds a
<sel>
operation using the long form of <set>
in
conjunction with <quote>
. The <sel>
operation is
constructed using the values selected from the two drop-down widgets. It is then appended to
the list that is stored in the dynamic variable xml_val
.
Inside the grid
widget, the value of the dynamic variable
xml_val
is specified for the xml_
attribute of the
<issue>
element. When the <issue>
element is
expanded, the resultant list of <sel>
operations is used as the query
for the grid
widget.
The dynamic variable xml_val
is also specified as the
xmlvalue_
attribute for the textbox
widget, which
displays all of the <sel>
operations.
Example: Using the tag_
and attrs_
attributes
In this example, a cross-tabulation on the table pub.demo.retail.item
is specified via two separate <issue>
elements. The outer
<issue>
tag is expanded to a <tabu>
element with
the attributes breaks
and cbreaks
. The inner
<issue>
tag is expanded to a <tcol>
element with
the attributes source
and fun
. The expansion of the inner
<issue>
tag is used as the contents of the tag resulting from the
expansion of the outer <issue>
tag.
<base table="pub.demo.retail.item"/> <issue tag_="tabu" attrs_="{pkg('breaks''cbreaks';'date''store')}"> <issue tag_="tcol" attrs_="{pkg('source''fun';'sales''sum')}"/> </issue>
This expands to the following code:
<base table="pub.demo.retail.item"/> <tabu breaks="date" cbreaks="store"> <tcol source="sales" fun="sum"/> </tabu>
Running the query results in the following: