cancel
Showing results for 
Search instead for 
Did you mean: 

X-Position from a computed field in Datawindow

Former Member
0 Kudos

Hi all


I have a computed field in the DataWindow. This should fix CF are at the position X. The width and the height are taken out of the data in the DB and is always different.

Now is the CF are always fixed on X and the width goes to the left.

example:

x = 2600

Width = 500

The CF is then positioned so that it is not related to the width of the X position. So always dynamically to each set.


How can I use the expression for Programming.



Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It is not clear to me what you want to do.

If you have a transparent CF and a text column and same background to the right, you can can just slide to the left.

How do you actually want to determine the needed width and height; do you have a method for it that you want to use?

If  you have a function to calculate it then you can put them in the width and height expression as global functions with current row.

Or in the global function test if there is a valid front window and then call a function on the window to return the values for that row.

Former Member
0 Kudos

Hi Ben,

I meant that the CF should remain at the same X position, but with the right-field limit. If the CF changed the width then the X-position needs to be changed but the right-field limit should not be changed. PB sees the X-position of the left-field. The X-Position must be changed if the width is more the the width befor (minus) or less-than the width befor (plus) the X-Position incl. the width befor. Or something like that.

x=500

width = 200

new width = 150 then

(x + width) + new width

or

new width = 300

(x + width) - new width

So I think it must be work but

unfortunately I have not found a code that is executable in the expression in the DW.

André

Former Member
0 Kudos

Hi André,

do you need something like this?

In this example the width of the first box depends on the value in the field. The second box changes its position and width depending on the width of the first box.

The easy way:

the name of my field with the width is "w"

expression for box1.width is simple: w

expression for box2.x: 869 + (w - 549)    // 869 is the x position of box2 in the design, 549 is the width of box1 in the design

expression for box2.width: 594 - (w - 549)  // 594 is the width of box2 in the design

If you don't want to write fix values (869, ...) in the expression you have to use the describe function (there is also one for datawindow expressions available!) to get this value. But remember to cut off the part with the expression after the ~t.

Former Member
0 Kudos

Hi,

Is this the effect what you are looking for?

Below is the export of a datawindow. For the default x-position and width of the CF I had taken 800 for both; which might be confusing.

And the columns you can make invisible or hidden if you want to.

The expressions for the CF are.

x="800~t800 + 800 -  width " y="40" height="80~t height " width="800~t width "

The width and height in the expressions are the column names that might have been stored in the database.

It is a 12.6 export; save it into a text file.

If you are using 12.5 just change release to 12.5 on the second line and try to import the file.

For older versions next to the release line you might have to delete some properties that didn't exist yet in that version for example the gradients. Importing will give errors and the position of the

error property. It can be a bit tedious to find and delete them.

One imported then view it in run-time.

$PBExportHeader$d_pos.srd

release 12.6;

datawindow(units=0 timer_interval=0 color=1073741824 brushmode=0 transparency=0 gradient.angle=0 gradient.color=8421504 gradient.focus=0 gradient.repetition.count=0 gradient.repetition.length=100 gradient.repetition.mode=0 gradient.scale=100 gradient.spread=100 gradient.transparency=0 picture.blur=0 picture.clip.bottom=0 picture.clip.left=0 picture.clip.right=0 picture.clip.top=0 picture.mode=0 picture.scale.x=100 picture.scale.y=100 picture.transparency=0 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.background=no print.preview.background=no print.preview.outline=yes hidegrayline=no showbackcoloronxp=no picture.file="" )

header(height=72 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" )

summary(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" )

footer(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" )

detail(height=260 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" )

table(column=(type=long updatewhereclause=yes name=rownr dbname="rownr" )

column=(type=long updatewhereclause=yes name=width dbname="width" )

column=(type=long updatewhereclause=yes name=height dbname="height" )

)

data( 1, 800, 80, 2, 400, 80, 3, 400, 160, 4, 200, 160,)

text(band=header alignment="2" text="Rownr" border="0" color="33554432" x="5" y="4" height="64" width="219" html.valueishtml="0"  name=rownr_t visible="1"  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" )

text(band=header alignment="2" text="Width" border="0" color="33554432" x="229" y="4" height="64" width="219" html.valueishtml="0"  name=width_t visible="1"  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" )

text(band=header alignment="2" text="Height" border="0" color="33554432" x="453" y="4" height="64" width="219" html.valueishtml="0"  name=height_t visible="1"  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" )

column(band=detail id=1 alignment="1" tabsequence=10 border="0" color="33554432" x="5" y="4" height="76" width="219" format="[general]" html.valueishtml="0"  name=rownr visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" )

column(band=detail id=2 alignment="1" tabsequence=20 border="0" color="33554432" x="229" y="4" height="76" width="219" format="[general]" html.valueishtml="0"  name=width visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" )

column(band=detail id=3 alignment="1" tabsequence=30 border="0" color="33554432" x="453" y="4" height="76" width="219" format="[general]" html.valueishtml="0"  name=height visible="1" edit.limit=0 edit.case=any edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" )

compute(band=detail alignment="1" expression="string(width) + ~" | ~" + string(height) "border="0" color="33554432" x="800~t800 + 800 -  width " y="40" height="80~t height " width="800~t width " format="[GENERAL]" html.valueishtml="0"  name=compute_1 visible="1"  font.face="Tahoma" font.height="-10" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="12639424" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="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()

Former Member
0 Kudos

Hi Ben


Thank you for your reply. I think that this is a solution.

André

Former Member
0 Kudos

Hi René

The solution is useful. I'll give it a try. Thank you.


André