Dynamic Xml To Datawindow In PowerBuilder
XML Syntax for XML2DW:
- Syntax 1 (Simple) – All column types are char(4000) and labels are constructed by replacing underscores in the column name with spaces and capitalizing each word
Syntax:
<column>column1 name</column>
<column>column2 name</column>
…
Example:
<column>col1</column>
<column>col2</column>
<column>col3</column>
- Syntax 2 (Complex) – NOTE: <value> element is used for dw testing and does not affect the resulting DW syntax. It simply sets that column’s value after syntax creation in the preview. It also doesn’t do anything if the <type> tag is used to change the column type from a type that accepts the entered string.
Syntax:
<column>
<name>column1 name</name>
[<label>column1 label</label>]
[<type>column1 datatype</type>]
[<width>column1 width</width>]
[<value>column1 value</value>]
</column>
<column>
<name>column2 name</name>
[<label>column2 label</label>]
[<type>column2 datatype</type>]
[<width>column2 width</width>]
[<value>column2 value</value>]
</column>
…
Example:
<column>
<name>col1</name>
<label>Column #1</label>
<type>char(10)</type>
<width>300</width>
<value>abcdefghij</value>
</column>
<column>
<name>col2</name>
<type>number</type>
<width>50</width>
</column>
<column>col3</column>
- Syntax 3 (Row data)
Syntax:
<tablename_row>
<column1 name>ignored data value1
[<label>column1 label</label>]
[<type>column1 datatype</type>]
[<width>column1 width</width>]
[<value>column1 value</value>]
</column1 name>
<column2 name>ignored data value2
[<label>column2 label</label>]
[<type>column2 datatype</type>]
[<width>column2 width</width>]
[<value>column2 value</value>]
</column2 name>
…
</tablename_row>
Example:
<table_row>
<col1>column #1</col1>
<col2>6/9/2003
<type>datetime</type>
</col2>
</table_row>
NOTES:
In syntax 2, all subtags are optional except if <name> is not used then all other subtags are ignored.
In syntax 3, all subtags are optional.
In 2 & 3, the order of the subtags does not matter. Also, if a subtag is found more than once for the same column, all instances of it will be ignored for that column.
In all syntaxes, any characters outside the tags are ignored.
Code Example:
Datawindow d_color_list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
release 10.5; datawindow(units=0 timer_interval=0 color=1073741824 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.preview.outline=yes hidegrayline=no ) header(height=0 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=64 color="536870912" ) table(column=(type=char(11) updatewhereclause=yes name=colorname dbname="colorname" ) column=(type=decimal(0) updatewhereclause=yes name=colorval dbname="colorval" ) ) data("Transparent", 536870912, "White", 16777215, "Black", 0, "Cream", 15793151, "Navy", 8388608, "Medium Gray", 10789024, "ButtonFace", 67108864, ) column(band=detail id=1 alignment="0" tabsequence=10 border="0" color="0" x="142" y="4" height="72" width="658" format="[general]" html.valueishtml="0" name=colorname visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) rectangle(band=detail x="5" y="0" height="60" width="123" name=r_1 visible="1" brush.hatch="6" brush.color="0~t colorval " pen.style="0" pen.width="5" pen.color="0" background.mode="2" background.color="0" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 ) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml() |
Datawindow d_dwparms
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
release 10.5; datawindow(units=0 timer_interval=0 color=67108864 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.preview.outline=yes hidegrayline=no ) header(height=0 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=976 color="536870912" ) table(column=(type=number updatewhereclause=no name=textx dbname="TextX" ) column=(type=number updatewhereclause=no name=texty dbname="TextY" ) column=(type=number updatewhereclause=no name=textfontsize dbname="TextFontSize" ) column=(type=number updatewhereclause=no name=textweight dbname="TextWeight" values=" 700/ 400" ) column=(type=number updatewhereclause=no name=textwidth dbname="TextWidth" ) column=(type=number updatewhereclause=no name=textcolor dbname="TextColor" ) column=(type=number updatewhereclause=no name=headerheight dbname="HeaderHeight" ) column=(type=number updatewhereclause=no name=detailheight dbname="DetailHeight" ) column=(type=number updatewhereclause=no name=backcolor dbname="BackColor" ) column=(type=number updatewhereclause=no name=colx dbname="ColX" ) column=(type=number updatewhereclause=no name=coly dbname="ColY" ) column=(type=number updatewhereclause=no name=colwidth dbname="ColWidth" ) column=(type=number updatewhereclause=no name=colheight dbname="ColHeight" ) column=(type=number updatewhereclause=no name=colborder dbname="ColBorder" values="NoBorder 0/ShadowBox 1/Box 2/ResizeBorder 3/Underline 4/Lowered 5/Raised 6/" ) column=(type=number updatewhereclause=no name=colbkgcolor dbname="ColBKGColor" ) column=(type=number updatewhereclause=no name=colcolor dbname="ColColor" ) column=(type=number updatewhereclause=no name=colfontsize dbname="ColFontSize" ) column=(type=number updatewhereclause=no name=colweight dbname="ColWeight" values=" 700/ 400" ) column=(type=number updatewhereclause=no name=vertspacing dbname="VertSpacing" ) column=(type=number updatewhereclause=no name=tabsequence dbname="TabSequence" values=" 1/ 0" ) ) groupbox(band=detail text="Labels"border="5" color="0" x="974" y="0" height="324" width="1705" name=gb_1 visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) groupbox(band=detail text="Columns"border="5" color="0" x="969" y="388" height="560" width="1705" name=gb_2 visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="0" text="BackColor" border="0" color="0" x="41" y="256" height="60" width="398" html.valueishtml="0" name=backcolor_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="HeaderHeight" border="0" color="0" x="41" y="376" height="60" width="398" html.valueishtml="0" name=headerheight_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="DetailHeight" border="0" color="0" x="41" y="496" height="60" width="398" html.valueishtml="0" name=detailheight_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="VertSpacing" border="0" color="0" x="41" y="616" height="60" width="398" html.valueishtml="0" name=vertspacing_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=19 alignment="0" tabsequence=190 border="5" color="0" x="453" y="612" height="64" width="219" format="[general]" html.valueishtml="0" name=vertspacing visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=7 alignment="0" tabsequence=70 border="5" color="0" x="453" y="372" height="64" width="219" format="[general]" html.valueishtml="0" name=headerheight visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=8 alignment="0" tabsequence=80 border="5" color="0" x="453" y="492" height="64" width="219" format="[general]" html.valueishtml="0" name=detailheight visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=13 alignment="0" tabsequence=130 border="5" color="0" x="2373" y="480" height="64" width="146" format="[general]" html.valueishtml="0" name=colheight visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=20 alignment="0" tabsequence=210 border="0" color="0" x="1344" y="840" height="64" width="73" format="[general]" html.valueishtml="0" name=tabsequence visible="1" checkbox.text="" checkbox.on="1" checkbox.off="0" checkbox.scale=no checkbox.threed=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) column(band=detail id=1 alignment="0" tabsequence=10 border="5" color="0" x="1134" y="88" height="64" width="146" format="[general]" html.valueishtml="0" name=textx visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) text(band=detail alignment="0" text="Y" border="0" color="0" x="1399" y="88" height="64" width="50" html.valueishtml="0" name=texty_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="Width" border="0" color="0" x="1737" y="88" height="60" width="169" html.valueishtml="0" name=textwidth_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=2 alignment="0" tabsequence=20 border="5" color="0" x="1472" y="88" height="64" width="146" format="[general]" html.valueishtml="0" name=texty visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=5 alignment="0" tabsequence=50 border="5" color="0" x="1915" y="88" height="64" width="146" format="[general]" html.valueishtml="0" name=textwidth visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=3 alignment="0" tabsequence=30 border="5" color="0" x="1312" y="208" height="64" width="114" format="[general]" html.valueishtml="0" name=textfontsize visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) text(band=detail alignment="0" text="Bold" border="0" color="0" x="1527" y="208" height="60" width="123" html.valueishtml="0" name=textweight_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=4 alignment="0" tabsequence=40 border="0" color="0" x="1669" y="208" height="64" width="73" format="[general]" html.valueishtml="0" name=textweight visible="1" checkbox.text="" checkbox.on="700" checkbox.off="400" checkbox.scale=no checkbox.threed=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="0" text="Color" border="0" color="0" x="1838" y="208" height="60" width="160" html.valueishtml="0" name=textcolor_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=14 alignment="0" tabsequence=140 border="5" color="8388608" x="2062" y="720" height="64" width="549" format="[general]" html.valueishtml="0" name=colborder visible="1" ddlb.limit=0 ddlb.allowedit=no ddlb.case=any ddlb.vscrollbar=yes ddlb.useasborder=yes font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="10789024" ) text(band=detail alignment="0" text="Height" border="0" color="0" x="2162" y="480" height="60" width="215" html.valueishtml="0" name=colheight_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="Border" border="0" color="0" x="1847" y="720" height="60" width="201" html.valueishtml="0" name=colborder_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="Y" border="0" color="0" x="1399" y="480" height="60" width="50" html.valueishtml="0" name=coly_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="Width" border="0" color="0" x="1737" y="480" height="60" width="169" html.valueishtml="0" name=colwidth_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=11 alignment="0" tabsequence=110 border="5" color="0" x="1472" y="480" height="64" width="146" format="[general]" html.valueishtml="0" name=coly visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=12 alignment="0" tabsequence=120 border="5" color="0" x="1915" y="480" height="64" width="146" format="[general]" html.valueishtml="0" name=colwidth visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=17 alignment="0" tabsequence=170 border="5" color="0" x="1312" y="596" height="64" width="114" format="[general]" html.valueishtml="0" name=colfontsize visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=18 alignment="0" tabsequence=180 border="0" color="0" x="1669" y="596" height="64" width="73" format="[general]" html.valueishtml="0" name=colweight visible="1" checkbox.text="" checkbox.on="700" checkbox.off="400" checkbox.scale=no checkbox.threed=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="553648127" ) text(band=detail alignment="0" text="Bold" border="0" color="0" x="1527" y="600" height="60" width="123" html.valueishtml="0" name=colweight_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="Color" border="0" color="0" x="1838" y="600" height="60" width="160" html.valueishtml="0" name=colcolor_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="Allow Edit" border="0" color="0" x="1061" y="840" height="60" width="270" html.valueishtml="0" name=tabsequence_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=10 alignment="0" tabsequence=100 border="5" color="0" x="1134" y="480" height="64" width="146" format="[general]" html.valueishtml="0" name=colx visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) text(band=detail alignment="0" text="FontSize" border="0" color="0" x="1061" y="600" height="60" width="242" html.valueishtml="0" name=colfontsize_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="BackColor" border="0" color="0" x="1061" y="720" height="60" width="283" html.valueishtml="0" name=colbkgcolor_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="FontSize" border="0" color="0" x="1061" y="208" height="64" width="238" html.valueishtml="0" name=textfontsize_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="X" border="0" color="0" x="1065" y="88" height="64" width="50" html.valueishtml="0" name=textx_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) text(band=detail alignment="0" text="X" border="0" color="0" x="1065" y="480" height="60" width="50" html.valueishtml="0" name=colx_t visible="1" font.face="Arial" font.height="-9" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=15 alignment="0" tabsequence=150 border="5" color="0" x="1358" y="720" height="64" width="471" format="[general]" html.valueishtml="0" name=colbkgcolor visible="1" dddw.name=d_color_list dddw.displaycolumn=colorname dddw.datacolumn=colorval dddw.percentwidth=150 dddw.lines=0 dddw.limit=0 dddw.allowedit=yes dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=16 alignment="0" tabsequence=160 border="5" color="0" x="2011" y="600" height="64" width="471" format="[general]" html.valueishtml="0" name=colcolor visible="1" dddw.name=d_color_list dddw.displaycolumn=colorname dddw.datacolumn=colorval dddw.percentwidth=150 dddw.lines=0 dddw.limit=0 dddw.allowedit=yes dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=9 alignment="0" tabsequence=90 border="5" color="0" x="453" y="260" height="64" width="471" format="[general]" html.valueishtml="0" name=backcolor visible="1" dddw.name=d_color_list dddw.displaycolumn=colorname dddw.datacolumn=colorval dddw.percentwidth=150 dddw.lines=0 dddw.limit=0 dddw.allowedit=yes dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) column(band=detail id=6 alignment="0" tabsequence=60 border="5" color="0" x="2011" y="208" height="64" width="471" format="[general]" html.valueishtml="0" name=textcolor visible="1" dddw.name=d_color_list dddw.displaycolumn=colorname dddw.datacolumn=colorval dddw.percentwidth=0 dddw.lines=0 dddw.limit=0 dddw.allowedit=yes dddw.useasborder=yes dddw.case=any dddw.vscrollbar=yes font.face="Arial" font.height="-9" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="15793151" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 ) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml() |
Datawidow d_dwtype
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
release 10.5; datawindow(units=0 timer_interval=0 color=67108864 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.preview.outline=yes hidegrayline=no ) header(height=0 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=60 color="536870912" ) table(column=(type=char(1) updatewhereclause=no name=dw_type dbname="dw_type" initial="F" values="Freeform F/Tabular T/Grid G/" ) ) column(band=detail id=1 alignment="0" tabsequence=10 border="0" color="8388608" x="306" y="4" height="56" width="2263" format="[general]" html.valueishtml="0" name=dw_type visible="1" radiobuttons.columns=3 radiobuttons.scale=no radiobuttons.threed=yes font.face="Arial" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 template=(comment="" encoding="UTF-8" name="d_dwtype" xml="<?xml version=~"1.0~" encoding=~"UTF-8~" standalone=~"no~"?><untitled><untitled_row __pbband=~"detail~"><dw_type>dw_type</dw_type></untitled_row></untitled>")) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml() |
nv_xml from nonvisualobject
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
forward global type nv_xml from nonvisualobject end type end forward global type nv_xml from nonvisualobject end type global nv_xml nv_xml forward prototypes public function string uf_getattribute (string a_sxml, string a_selement, string a_sattribute) public function string uf_getelement (string a_sxml, string a_selement) public function string uf_getvalue (string a_sxml, string a_selement) public function string uf_setattribute (string a_sxml, string a_selement, string a_sattribute, string a_svalue) public function string uf_setelement (string a_sxml, string a_selement, string a_svalue) public function string uf_setvalue (string a_sxml, string a_selement, string a_svalue) public function string uf_addelement (string a_sxml, string a_sparentelement, string a_snewelement, string a_svalue, boolean a_bempty) public function string uf_parse_into_ds (string a_sxml, string a_snode, datastore a_ds) end prototypes public function string uf_getattribute (string a_sxml, string a_selement, string a_sattribute);//==================================================================== // Function: nv_xml.uf_getattribute() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_selement // value string a_sattribute //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_getattribute ( string a_sxml, string a_selement, string a_sattribute ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPos String sRet String sXMLsubstring lPos = Pos(a_sXML, '<' + a_sElement) If lPos = 0 Then sRet = 'ERROR: Invalid Element' Else sXMLsubstring = Mid( a_sXML, lPos) lPos = Pos(sXMLsubstring, a_sAttribute) If lPos = 0 Then sRet = 'ERROR: Invalid Attribute' Else sXMLsubstring = Mid( sXMLsubstring, lPos) sXMLsubstring = Mid( sXMLsubstring, Pos(sXMLsubstring, '=')) lPos = Pos(sXMLsubstring, '"') sRet = Mid( sXMLsubstring, lPos + 1, Pos(sXMLsubstring, '"', lPos + 1) - lPos - 1) End If End If Return sRet end function public function string uf_getelement (string a_sxml, string a_selement);//==================================================================== // Function: nv_xml.uf_getelement() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_selement //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_getelement ( string a_sxml, string a_selement ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPos Long lOpenTagLen String sRet String sOpenTag String sCloseTag sOpenTag = '<' + a_sElement + '>' sCloseTag = '</' + a_sElement + '>' lOpenTagLen = Len(sOpenTag) lPos = Pos(a_sXML, sOpenTag) If lPos = 0 Then sRet = 'ERROR: Invalid Element' Else If Pos(a_sXML, sOpenTag, lPos + lOpenTagLen) = 0 Then sRet = Mid(a_sXML, lPos, Pos(a_sXML, sCloseTag) - lPos + lOpenTagLen + 1) Else sRet = 'ERROR: Multiple instances of the element - cannot retrieve a single value.' End If End If Return sRet end function public function string uf_getvalue (string a_sxml, string a_selement);//==================================================================== // Function: nv_xml.uf_getvalue() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_selement //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_getvalue ( string a_sxml, string a_selement ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPos Long lOpenTagLen String sRet String sOpenTag String sCloseTag sOpenTag = '<' + a_sElement + '>' sCloseTag = '</' + a_sElement + '>' lOpenTagLen = Len(sOpenTag) lPos = Pos(a_sXML, sOpenTag) If lPos = 0 Then sRet = 'ERROR: Invalid Element' Else If Pos(a_sXML, sOpenTag, lPos + lOpenTagLen) = 0 Then sRet = Mid(a_sXML, lPos + lOpenTagLen, Pos(a_sXML, sCloseTag) - lPos - lOpenTagLen) Else sRet = 'ERROR: Multiple instances of the element - cannot retrieve a single value.' End If End If Return sRet end function public function string uf_setattribute (string a_sxml, string a_selement, string a_sattribute, string a_svalue);//==================================================================== // Function: nv_xml.uf_setattribute() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_selement // value string a_sattribute // value string a_svalue //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_setattribute ( string a_sxml, string a_selement, string a_sattribute, string a_svalue ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPosAttrib Long lPos String sRet String sXMLSubstring lPos = Pos(a_sXML, '<' + a_sElement) If lPos = 0 Then sRet = 'ERROR: Invalid Element' Else lPosAttrib = lPos // lposA = pos of element sXMLSubstring = Mid( a_sXML, lPos) // substr = xml starting from element lPos = Pos(sXMLSubstring, a_sAttribute) //lpos = pos of attribute starting from element If lPos = 0 Then sRet = 'ERROR: Invalid Attribute' Else lPosAttrib = lPosAttrib + lPos - 1 //lPosAttrib = pos of attribute sXMLSubstring = Mid( sXMLSubstring, lPos) //substr = xml starting from attribute name lPos = Pos(sXMLSubstring, '"') //lPos = pos of first " starting from attribute lPosAttrib = lPosAttrib + lPos - 1 //lPosAttrib = pos of first " sXMLSubstring = Mid( sXMLSubstring, lPos ) //substr = everything from 1st " lPos = Pos(sXMLSubstring, '"', 2) // lPos = pos of next quote sRet = Mid(a_sXML, 1, lPosAttrib ) + a_sValue + Mid( sXMLSubstring, lPos ) // XML up to just before 1st quote End If End If Return sRet end function public function string uf_setelement (string a_sxml, string a_selement, string a_svalue);//==================================================================== // Function: nv_xml.uf_setelement() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_selement // value string a_svalue //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_setelement ( string a_sxml, string a_selement, string a_svalue ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPos Long lOpenTagLen String sRet String sOpenTag String sCloseTag sOpenTag = '<' + a_sElement + '>' sCloseTag = '</' + a_sElement + '>' lOpenTagLen = Len(sOpenTag) lPos = Pos(a_sXML, sOpenTag) If lPos = 0 Then sRet = a_sXML + a_sValue Else If Pos(a_sXML, sOpenTag, lPos + lOpenTagLen) = 0 Then sRet = Mid(a_sXML, 1, lPos - 1) + a_sValue + Mid(a_sXML, Pos(a_sXML, sCloseTag) + lOpenTagLen + 1) Else sRet = 'ERROR: Multiple instances of the element - cannot set a single value.' End If End If Return sRet end function public function string uf_setvalue (string a_sxml, string a_selement, string a_svalue);//==================================================================== // Function: nv_xml.uf_setvalue() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_selement // value string a_svalue //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_setvalue ( string a_sxml, string a_selement, string a_svalue ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPos Long lOpenTagLen String sRet String sOpenTag String sCloseTag sOpenTag = '<' + a_sElement + '>' sCloseTag = '</' + a_sElement + '>' lOpenTagLen = Len(sOpenTag) lPos = Pos(a_sXML, sOpenTag) If lPos = 0 Then sRet = a_sXML + sOpenTag + a_sValue + sCloseTag Else If Pos(a_sXML, sOpenTag, lPos + lOpenTagLen) = 0 Then sRet = Mid(a_sXML, 1, lPos + lOpenTagLen - 1) + a_sValue + Mid(a_sXML, Pos(a_sXML, sCloseTag) ) Else sRet = 'ERROR: Multiple instances of the element - cannot set a single value.' End If End If Return sRet end function public function string uf_addelement (string a_sxml, string a_sparentelement, string a_snewelement, string a_svalue, boolean a_bempty);//==================================================================== // Function: nv_xml.uf_addelement() //-------------------------------------------------------------------- // Description: adds a node to the XML string currently value is optional doesn't support attributes //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_sparentelement // value string a_snewelement // value string a_svalue // value boolean a_bempty if true, element is added as <NewElement/> //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_addelement ( string a_sxml, string a_sparentelement, string a_snewelement, string a_svalue, boolean a_bempty ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Long lPosStart Long lPosEnd Long lOpenTagLen String sRet String sOpenTag String sCloseTag String sNewString String sParentSubstring If a_bEmpty Then sNewString = "<" + a_snewelement + "/>" Else sNewString = "<" + a_snewelement + ">" + a_svalue + "</" + a_snewelement + ">" End If sOpenTag = '<' + a_sParentElement + '>' sCloseTag = '</' + a_sParentElement + '>' lOpenTagLen = Len(sOpenTag) lPosStart = Pos(a_sXML, sOpenTag) If lPosStart = 0 Then sRet = 'ERROR: Parent element not found' Else lPosEnd = Pos(a_sXML, sCloseTag, lPosStart) If lPosEnd < 1 Then sRet = 'ERROR: Closing tag of parent element not found' ElseIf Pos(a_sXML, sOpenTag, lPosEnd) > 0 Then sRet = 'ERROR: Multiple instances of parent element found' Else sParentSubstring = Mid(a_sXML, lPosStart, lPosEnd - lPosStart + 1) If Pos(sParentSubstring, sNewString) > 0 Then sRet = a_sXML Else sRet = Left(a_sXML, lPosEnd - 1) + sNewString + Mid(a_sXML, lPosEnd) End If End If End If Return sRet end function public function string uf_parse_into_ds (string a_sxml, string a_snode, datastore a_ds);//==================================================================== // Function: nv_xml.uf_parse_into_ds() //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: // value string a_sxml // value string a_snode // value datastore a_ds //-------------------------------------------------------------------- // Returns: string //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: nv_xml.uf_parse_into_ds ( string a_sxml, string a_snode, datastore a_ds ) //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== String sXMLSubstring If IsValid(a_ds) Then sXMLSubstring = uf_getelement(a_sXML, a_sNode) a_ds.ImportString(XML!, sXMLSubstring) End If Return "OK" end function on nv_xml.create call super::create TriggerEvent( this, "constructor" ) end on on nv_xml.destroy TriggerEvent( this, "destructor" ) call super::destroy end on |
s_dwparms from structure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
global type s_dwparms from structure character ctype string sxml long ltextwidth long ltextx long ltexty long ltextfontsize long ltextweight long ltextcolor long lheaderheight long ldetailheight long lbackcolor long lcolx long lcoly long lcolwidth long lcolheight long lcolbkgcolor long lcolcolor long lcolfontsize long lcolweight long lcolborder long lvertspacing string stextband long ltabsequence string sDW end type |
gf_create_from_xml from function_object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
global type gf_create_from_xml from function_object end type forward prototypes global function string gf_create_from_xml (ref s_dwparms a_dwparms, ref string a_serror, datawindow a_dw) end prototypes global function string gf_create_from_xml (ref s_dwparms a_dwparms, ref string a_serror, datawindow a_dw);//==================================================================== // Function: () //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: //-------------------------------------------------------------------- // Returns: (none) //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Boolean bTagsRCols Long lPos Long lPos2 Long lEndPos Long lColumn Long lTextX Long lTextY Long lTextWidth Long lColX Long lColY Long lColWidth Long lVertSpacing String sXML String sHeader String sTable String sObjects String sFooter String sColumnString String sColumnName String sColumnType String sColumnLabel String sData String sTemp String sTag nv_xml nvXML a_dw.Post InsertRow(0) a_dw.Post InsertRow(0) sXML = a_dwparms.sXML lColX = a_dwparms.lColX lColY = a_dwparms.lColY lColWidth = a_dwparms.lColWidth lTextX = a_dwparms.lTextX lTextY = a_dwparms.lTextY lTextWidth = a_dwparms.lTextWidth lVertSpacing = a_dwparms.lColHeight + a_dwparms.lVertSpacing nvXML = Create nv_xml lEndPos = 1 Do If bTagsRCols Then lPos2 = Pos(sXML, ">", lEndPos) If lPos2 = 0 Then lPos = 0 Else For lPos = lPos2 - 1 To lEndPos Step -1 Choose Case Mid(sXML, lPos, 1) Case "<", ">", " " Exit End Choose Next lEndPos = lPos2 + 1 If Mid(sXML, lPos, 1) = "<" Then sTag = Mid(sXML, lPos + 1, lPos2 - lPos - 1) Else Continue End If End If Else lPos = Pos(sXML, "<column>", lEndPos) lPos2 = Pos(sXML, "_row>", lEndPos) If (lPos2 < lPos Or lPos = 0) And lPos2 > 0 And lColumn = 0 Then For lPos = lPos2 - 1 To lEndPos Step -1 Choose Case Mid(sXML, lPos, 1) Case "<", ">", " ", "/" Exit End Choose Next lEndPos = lPos2 + 5 If Mid(sXML, lPos, 1) = "<" Then sTag = Mid(sXML, lPos + 1, lPos2 - lPos + 3) lPos = lPos2 + 5 lPos2 = Pos(sXML, "</" + sTag + ">", lPos) If lPos2 > 0 Then sXML = Mid(sXML, lPos, lPos2 - lPos) lEndPos = 1 bTagsRCols = True Continue End If End If Continue Else sTag = "column" End If End If If lPos > 0 Then lPos += Len(sTag) + 2 lEndPos = Pos(sXML, "</" + sTag + ">", lPos) lColumn ++ If lEndPos = 0 Then lEndPos = lPos sColumnString = "" Else sColumnString = Mid(sXML, lPos, lEndPos - lPos) End If If bTagsRCols Then sColumnName = sTag If Right(sColumnName, 1) = "/" Then sColumnName = Left(sColumnName, Len(sColumnName) - 1) End If Else sColumnName = nvXML.uf_GetValue(sColumnString, "name") End If If Left(sColumnName, 7) = "ERROR: " Then sColumnName = Trim(sColumnString) sColumnType = "" sColumnLabel = "" lColWidth = a_dwparms.lColWidth lTextWidth = lColWidth sData = "" Else sColumnType = nvXML.uf_GetValue(sColumnString, "type") If Left(sColumnType, 7) = "ERROR: " Then sColumnType = "" End If sColumnLabel = nvXML.uf_GetValue(sColumnString, "label") If Left(sColumnLabel, 7) = "ERROR: " Then sColumnLabel = "" End If sTemp = nvXML.uf_GetValue(sColumnString, "width") If Left(sTemp, 7) = "ERROR: " Then lColWidth = a_dwparms.lColWidth Else lColWidth = Long(sTemp) End If If a_dwparms.cType <> 'F' Then lTextWidth = lColWidth End If sData = nvXML.uf_GetValue(sColumnString, "value") If Left(sData, 7) = "ERROR: " Then sData = "" End If End If If sColumnType = "" Then sColumnType = "char(4000)" End If If sColumnLabel = "" Then sColumnLabel = gf_proper_name(sColumnName) End If sTable += "column=(type=" + sColumnType + " updatewhereclause=yes name=" + sColumnName + ' dbname="' + sColumnName + '" )~r~n' sObjects += "text(band=" + a_dwparms.sTextBand + ' alignment="0" text="' + & sColumnLabel + '" border="0" color="' + String(a_dwparms.lTextColor) + & '" x="' + String(lTextX) + '" y="' + String(lTextY) + & '" height="64" width="' + String(lTextWidth) + & '" html.valueishtml="0" name=' + sColumnName + & '_t visible="1" font.face="Arial" font.height="' + & String(a_dwparms.lTextFontSize) + '" font.weight="' + & String(a_dwparms.lTextWeight) + '" font.family="2" font.pitch="2" ' + & 'font.charset="0" background.mode="1" background.color="536870912" )~r~n' + & '' + & 'column(band=detail id=' + String(lColumn) + & ' alignment="0" tabsequence=' + String(lColumn * 10 * a_dwparms.lTabSequence) + & ' border="' + String(a_dwparms.lColBorder) + '" color="' + & String(a_dwparms.lColColor) + '" x="' + String(lColX) + & '" y="' + String(lColY) + '" height="' + String(a_dwparms.lColHeight) + & '" width="' + String(lColWidth) + & '" format="[general]" html.valueishtml="0" name=' + sColumnName + & ' visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no ' + & 'edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 ' + & 'font.face="Arial" font.height="' + String(a_dwparms.lColFontSize) + & '" font.weight="' + String(a_dwparms.lColWeight) + & '" font.family="2" font.pitch="2" font.charset="0" ' + & 'background.mode="2" background.color="' + & String(a_dwparms.lColBKGColor) + '" )~r~n' If a_dwparms.cType = 'T' Or a_dwparms.cType = 'G' Then lColX += a_dwparms.lColX + lColWidth lTextX = lColX ElseIf a_dwparms.cType = 'F' Then lTextY += lVertSpacing lColY += lVertSpacing End If If sData <> "" Then a_dw.Post SetItem(1, sColumnName, sData) a_dw.Post SetItem(2, sColumnName, sData) End If lEndPos += Len(sTag) + 3 Else Exit End If Loop While True Destroy(nvXML) String ls_PBver environment env GetEnvironment(env) ls_PBver = String(env.PBMajorRevision) + '.' + String(env.PBMinorRevision) sHeader = 'release '+ls_PBver+';~r~ndatawindow(units=0 timer_interval=0 color=' + String(a_dwparms.lBackColor) + & a_dwparms.sDW + '~r~n' + & 'header(height=' + String(a_dwparms.lHeaderHeight) + ' color="536870912" )~r~n' + & 'summary(height=0 color="536870912" )~r~n' + & 'footer(height=0 color="536870912" )~r~n' + & 'detail(height=' + String(a_dwparms.lDetailHeight + lColY + a_dwparms.lColHeight) + & ' color="536870912" )~r~ntable(' sFooter = 'htmltable(border="1" )~r~n' + & 'htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )~r~n' + & 'export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )~r~n' + & 'import.xml()~r~n' + & 'export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )' Return(sHeader + sTable + ")~r~n" + sObjects + sFooter) end function |
gf_proper_name from function_object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
global type gf_proper_name from function_object end type forward prototypes global function string gf_proper_name (string name) end prototypes global function string gf_proper_name (string name);//==================================================================== // Function: () //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: //-------------------------------------------------------------------- // Returns: (none) //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== String sProperName Long lpos Long lpos2 sProperName = Trim(Name) If ( ( Len(sProperName) < 1 ) ) Then Return(sProperName) End If // change underscore to single space lpos2 = Pos(sProperName, "_") If ( lpos2 > 0 ) Then Do While lpos2 > 0 sProperName = Replace(sProperName, lpos2, 1, " ") lpos2 = Pos(sProperName, "_") Loop End If // change SMITH to Smith, start at each word separated by single space sProperName = Upper(Mid(sProperName,1,1))+ Lower(Mid(sProperName, 2) ) lpos2 = Pos(sProperName," ") If ( lpos2 > 0 ) Then Do While lpos2 > 0 sProperName = Replace(sProperName,lpos2+1,1,Upper(Mid(sProperName,lpos2+1,1) ) ) lpos2 = Pos(sProperName," ", lpos2+1 ) Loop End If sProperName = Trim(sProperName) Return(sProperName) end function |
gf_set_default_dw_parms from function_object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
global type gf_set_default_dw_parms from function_object end type forward prototypes global subroutine gf_set_default_dw_parms (ref s_dwparms a_dwparms) end prototypes global subroutine gf_set_default_dw_parms (ref s_dwparms a_dwparms);//==================================================================== // Function: () //-------------------------------------------------------------------- // Description: //-------------------------------------------------------------------- // Arguments: //-------------------------------------------------------------------- // Returns: (none) //-------------------------------------------------------------------- // Author: PB.BaoGa Date: 2023/03/21 //-------------------------------------------------------------------- // Usage: //-------------------------------------------------------------------- // Copyright (c) PB.BaoGa(TM), All rights reserved. //-------------------------------------------------------------------- // Modify History: // //==================================================================== Constant Long TXT_BOLD = 700 Constant Long TXT_NORMAL = 400 If a_dwparms.cType = 'F' Then a_dwparms.lTextX = 14 a_dwparms.lTextWidth = 302 a_dwparms.lColX = 338 a_dwparms.lColWidth = 869 a_dwparms.lTextFontSize = -9 a_dwparms.lTextWeight = TXT_NORMAL a_dwparms.lTextColor = 0 a_dwparms.lColFontSize = -10 a_dwparms.lColWeight = TXT_NORMAL a_dwparms.lColColor = 0 a_dwparms.lColBKGColor = 536870912 a_dwparms.lColBorder = 5 a_dwparms.lBackColor = 16777215 a_dwparms.lColHeight = 72 a_dwparms.lColY = 8 a_dwparms.lTextY = 12 a_dwparms.lVertSpacing = 40 a_dwparms.lHeaderHeight = 0 a_dwparms.lDetailHeight = -80 a_dwparms.sTextBand = "detail" a_dwparms.lTabSequence = 1 a_dwparms.sDW = ' processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )' End If If a_dwparms.cType = 'T' Or a_dwparms.cType = 'G' Then If a_dwparms.cType = 'G' Then a_dwparms.sDW = ' processing=1 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no grid.lines=0 selected.mouse=no )' Else a_dwparms.sDW = ' processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )' End If a_dwparms.lBackColor = 16777215 a_dwparms.lTextX = 9 a_dwparms.lTextWidth = 302 a_dwparms.lColX = 9 a_dwparms.lColWidth = 302 a_dwparms.lTextFontSize = -8 a_dwparms.lTextWeight = TXT_BOLD a_dwparms.lTextColor = 0 a_dwparms.lColFontSize = -10 a_dwparms.lColWeight = TXT_NORMAL a_dwparms.lColColor = 0 a_dwparms.lColBKGColor = 536870912 a_dwparms.lColBorder = 0 a_dwparms.lColHeight = 70 a_dwparms.lColY = 4 a_dwparms.lTextY = 8 a_dwparms.lVertSpacing = 0 a_dwparms.lHeaderHeight = 60 a_dwparms.lDetailHeight = 4 a_dwparms.sTextBand = "header" a_dwparms.lTabSequence = 0 End If end subroutine |
w_createdw from window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
forward global type w_createdw from window end type type cb_restart from commandbutton within w_createdw end type type mle_syntax from multilineedit within w_createdw end type type dw_1 from datawindow within w_createdw end type end forward global type w_createdw from window integer width = 2921 integer height = 2144 boolean titlebar = true string title = "Datawindow" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_restart cb_restart mle_syntax mle_syntax dw_1 dw_1 end type global w_createdw w_createdw on w_createdw.create this.cb_restart=create cb_restart this.mle_syntax=create mle_syntax this.dw_1=create dw_1 this.Control[]={this.cb_restart,& this.mle_syntax,& this.dw_1} end on on w_createdw.destroy destroy(this.cb_restart) destroy(this.mle_syntax) destroy(this.dw_1) end on event open; Long lFile s_dwparms dwparms String sSyntax String sError String sPathName String sFileName dwparms = Message.PowerObjectParm sSyntax = gf_create_from_xml(dwparms, sError, dw_1) mle_syntax.Text = sSyntax dw_1.Create(sSyntax, sError) If sError <> "" Then MessageBox("XML2DW", "DW Syntax Error:~r~n~r~n" + sError) Else If GetFileSaveName("Export DW Syntax", sPathName, sFileName, "srd", "DataWindow Syntax (*.srd),*.srd") > 0 Then lFile = FileOpen(sPathName, LineMode!, Write!, LockWrite!, Replace!) If lFile > 0 Then FileWrite(lFile, "$PBExportHeader$" + sFileName + "~r~n" + sSyntax) FileClose(lFile) End If End If End If end event type cb_restart from commandbutton within w_createdw integer x = 1303 integer y = 1916 integer width = 247 integer height = 88 integer taborder = 30 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "Restart" end type event clicked;g_bRestart = True Close(Parent) end event type mle_syntax from multilineedit within w_createdw integer x = 46 integer y = 20 integer width = 2775 integer height = 864 integer taborder = 10 integer textsize = -9 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long backcolor = 15793151 boolean vscrollbar = true boolean autohscroll = true boolean displayonly = true borderstyle borderstyle = stylelowered! end type type dw_1 from datawindow within w_createdw integer x = 46 integer y = 888 integer width = 2775 integer height = 988 integer taborder = 20 string title = "none" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type |
w_dwparams from window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
forward global type w_dwparams from window end type type cb_back from commandbutton within w_dwparams end type type cb_ok from commandbutton within w_dwparams end type type cb_import from commandbutton within w_dwparams end type type dw_parms from datawindow within w_dwparams end type type dw_preview from datawindow within w_dwparams end type type mle_xml from multilineedit within w_dwparams end type end forward global type w_dwparams from window integer width = 2907 integer height = 2160 boolean titlebar = true string title = "Datawindow Parms" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_back cb_back cb_ok cb_ok cb_import cb_import dw_parms dw_parms dw_preview dw_preview mle_xml mle_xml end type global w_dwparams w_dwparams type variables s_dwparms i_dwparms end variables on w_dwparams.create this.cb_back=create cb_back this.cb_ok=create cb_ok this.cb_import=create cb_import this.dw_parms=create dw_parms this.dw_preview=create dw_preview this.mle_xml=create mle_xml this.Control[]={this.cb_back,& this.cb_ok,& this.cb_import,& this.dw_parms,& this.dw_preview,& this.mle_xml} end on on w_dwparams.destroy destroy(this.cb_back) destroy(this.cb_ok) destroy(this.cb_import) destroy(this.dw_parms) destroy(this.dw_preview) destroy(this.mle_xml) end on event open;dw_parms.InsertRow(0) end event type cb_back from commandbutton within w_dwparams string tag = "1" integer x = 1207 integer y = 1936 integer width = 247 integer height = 88 integer taborder = 30 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" boolean enabled = false string text = "Back" end type event clicked;This.Enabled = False dw_preview.Hide() mle_xml.Show() cb_import.Text = "Import" cb_ok.Text = "Next" cb_import.X = 2560 cb_import.Y = 40 dw_parms.Width = 2496 dw_parms.Height = 96 dw_parms.DataObject = "d_dwtype" dw_parms.InsertRow(0) dw_parms.SetItem(1, "dw_type", i_dwparms.cType) cb_ok.Tag = "1" end event type cb_ok from commandbutton within w_dwparams string tag = "1" integer x = 1513 integer y = 1936 integer width = 247 integer height = 88 integer taborder = 30 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "Next" end type event clicked;If This.Tag = "1" Then This.Tag = "2" This.Text = "Create" i_dwparms.cType = dw_parms.GetItemString(1, "dw_type") i_dwparms.sXML = mle_xml.Text gf_set_default_dw_parms(i_dwparms) dw_parms.DataObject = "d_dwparms" dw_parms.InsertRow(0) dw_parms.SetItem(1, "textx", i_dwparms.lTextX) dw_parms.SetItem(1, "texty", i_dwparms.lTextY) dw_parms.SetItem(1, "textwidth", i_dwparms.lTextWidth) dw_parms.SetItem(1, "textfontsize", i_dwparms.lTextFontSize) dw_parms.SetItem(1, "textweight", i_dwparms.lTextWeight) dw_parms.SetItem(1, "textcolor", i_dwparms.lTextColor) dw_parms.SetItem(1, "headerheight", i_dwparms.lHeaderHeight) dw_parms.SetItem(1, "detailheight", i_dwparms.lDetailHeight) dw_parms.SetItem(1, "backcolor", i_dwparms.lBackColor) dw_parms.SetItem(1, "colx", i_dwparms.lColX) dw_parms.SetItem(1, "coly", i_dwparms.lColY) dw_parms.SetItem(1, "colwidth", i_dwparms.lColWidth) dw_parms.SetItem(1, "colheight", i_dwparms.lColHeight) dw_parms.SetItem(1, "colfontsize", i_dwparms.lColFontSize) dw_parms.SetItem(1, "colweight", i_dwparms.lColWeight) dw_parms.SetItem(1, "colcolor", i_dwparms.lColColor) dw_parms.SetItem(1, "colbkgcolor", i_dwparms.lColBKGColor) dw_parms.SetItem(1, "colborder", i_dwparms.lColBorder) dw_parms.SetItem(1, "vertspacing", i_dwparms.lVertSpacing) dw_parms.SetItem(1, "tabsequence", i_dwparms.lTabSequence) dw_preview.TriggerEvent("ue_preview") mle_xml.Hide() dw_preview.Show() dw_parms.Width = 2757 dw_parms.Height = 1016 cb_import.Text = "Preview" cb_import.X = 1339 cb_import.Y = 1096 cb_back.Enabled = True ElseIf This.Tag = "2" Then dw_preview.TriggerEvent("ue_preview") Hide(Parent) OpenWithParm(w_createdw, i_dwparms) Close(Parent) End If /*<columnset> <column>dan</column> <column>fred</column> </columnset>*/ end event type cb_import from commandbutton within w_dwparams integer x = 2560 integer y = 40 integer width = 247 integer height = 88 integer taborder = 20 integer textsize = -8 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "Import" end type event clicked;long lFile string sFilename string sPathname string sLine string sXML if this.text = "Import" then if GetFileOpenName("Import XML file...", sPathname, sFilename, "*", "All Files (*.*), *.*") > 0 then lFile = FileOpen(sPathname) if lFile > 0 then do while FileRead(lFile, sLine) > 0 if sXML <> "" then sXML += "~r~n" end if sXML += sLine loop FileClose(lFile) mle_XML.text = sXML end if end if else dw_preview.TriggerEvent("ue_preview") end if end event type dw_parms from datawindow within w_dwparams integer x = 50 integer y = 40 integer width = 2496 integer height = 96 integer taborder = 10 string title = "none" string dataobject = "d_dwtype" boolean livescroll = true borderstyle borderstyle = stylelowered! end type type dw_preview from datawindow within w_dwparams event ue_preview ( ) boolean visible = false integer x = 50 integer y = 1208 integer width = 2757 integer height = 688 integer taborder = 20 string title = "none" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event ue_preview();string sError dw_parms.AcceptText() i_dwparms.lTextX = dw_parms.GetItemNumber(1, "textx") i_dwparms.lTextY = dw_parms.GetItemNumber(1, "texty") i_dwparms.lTextWidth = dw_parms.GetItemNumber(1, "textwidth") i_dwparms.lTextFontSize = dw_parms.GetItemNumber(1, "textfontsize") i_dwparms.lTextWeight = dw_parms.GetItemNumber(1, "textweight") i_dwparms.lTextColor = dw_parms.GetItemNumber(1, "textcolor") i_dwparms.lHeaderHeight = dw_parms.GetItemNumber(1, "headerheight") i_dwparms.lDetailHeight = dw_parms.GetItemNumber(1, "detailheight") i_dwparms.lBackColor = dw_parms.GetItemNumber(1, "backcolor") i_dwparms.lColX = dw_parms.GetItemNumber(1, "colx") i_dwparms.lColY = dw_parms.GetItemNumber(1, "coly") i_dwparms.lColWidth = dw_parms.GetItemNumber(1, "colwidth") i_dwparms.lColHeight = dw_parms.GetItemNumber(1, "colheight") i_dwparms.lColFontSize = dw_parms.GetItemNumber(1, "colfontsize") i_dwparms.lColWeight = dw_parms.GetItemNumber(1, "colweight") i_dwparms.lColColor = dw_parms.GetItemNumber(1, "colcolor") i_dwparms.lColBKGColor = dw_parms.GetItemNumber(1, "colbkgcolor") i_dwparms.lColBorder = dw_parms.GetItemNumber(1, "colborder") i_dwparms.lVertSpacing = dw_parms.GetItemNumber(1, "vertspacing") i_dwparms.lTabSequence = dw_parms.GetItemNumber(1, "tabsequence") this.create(gf_create_from_xml(i_dwparms, sError, this), sError) end event type mle_xml from multilineedit within w_dwparams integer x = 50 integer y = 140 integer width = 2757 integer height = 1756 integer taborder = 20 integer textsize = -9 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long backcolor = 15793151 boolean vscrollbar = true boolean autohscroll = true borderstyle borderstyle = stylelowered! end type |
dynamicxmltodw from application
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
forward global type dynamicxmltodw from application end type global transaction sqlca global dynamicdescriptionarea sqlda global dynamicstagingarea sqlsa global error error global message message end forward global variables boolean g_bRestart end variables global type dynamicxmltodw from application string appname = "dynamicxmltodw" end type global dynamicxmltodw dynamicxmltodw on dynamicxmltodw.create appname="dynamicxmltodw" message=create message sqlca=create transaction sqlda=create dynamicdescriptionarea sqlsa=create dynamicstagingarea error=create error end on on dynamicxmltodw.destroy destroy(sqlca) destroy(sqlda) destroy(sqlsa) destroy(error) destroy(message) end on event open;Do g_bRestart = False Open(w_dwparams) Loop While g_bRestart end event |
Find Projects On Github click here
Good Luck!