FixedWidth return a space (blank) padded string "Length" long where Value is positioned according to the position switch.
The purpose of the function is to make it easier to build columns in a text file/export/console output.
The function is created to make DFW more compatible with DFD style thinking and output.
Especially useful in combination with WriteToFile(), ConsoleCopy() etc.
Value: String, but will automatically convert any DataEase field type to string. Can be up to 255 long.
Position:
0 = Left (Default) - "This is a test "
1= Center - " This is a test "
2= Right - " This is a test"
Length: The length of the padded string to be returned.
Example 1:
define temp "retval" text .
define temp "spacer" text 255 .
define temp "line" text 69 .
define temp "looper" number .
looper := 0 .
spacer :=" " .
line := "-------------------------------------------------------------------------------------------------------------------------" .
while looper <25 do
retval := ConsoleCopy(" ",5+0) .
looper := Looper +1 .
end
looper := 0 .
retval := ConsoleCopy(" ",5+0) .
for WriteToFile with OrderNr = Data-entry Field1 ;
while MemoChunk(Header,Looper) not=blank do
retval := ConsoleCopy(MemoChunk(Header,Looper),0) .
looper :=looper + 1 .
end
retval := ConsoleCopy(" ",4+0) .
retval := ConsoleCopy(Subject,4+0) .
retval := ConsoleCopy(" ",4+0) .
retval :=ConsoleCopy(concat(FixedWidth("Productnr", 0 , 15),fixedWidth("Product Description", 0 , 29),FixedWidth("Price", 1+1 , 10),FixedWidth("#", 1+0 , 5),FixedWidth("Total",2+0,10)) , 4+0) .
retval := ConsoleCopy(line, 4+0) .
for Orderlines with Ordernr = WriteToFile Ordernr ;
retval := ConsoleCopy(concat(FixedWidth(productNr,0,15) ,FixedWidth(Description,0,29),FixedWidth(Prices,2,10),FixedWidth(Count ,2,5),FixedWidth(Total,2,10)), 4+0) .
end
retval := ConsoleCopy(" ",5+0) .
retval := ConsoleCopy(FixedWidth(concat("Total Order: ", Total Order),2,69),4+0) .
retval := ConsoleCopy(line, 4+0) .
retval := ConsoleCopy(" ",5+0) .
retval := ConsoleCopy(" ",5+0) .
Looper := 0 .
while MemoChunk(Footer,Looper) not=blank do
retval := ConsoleCopy(MemoChunk(Footer,Looper),0) .
looper :=looper + 1 .
end
retval := ConsoleShow(1) .
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 14/11/13 at 13:50:29
Product: Dataease [{8}]FIVE. Written by DataEase 14/11/13 at 17:02:34
Product: Dataease [{8}]FIVE. Written by Bill Nicholson 20/12/14 at 17:23:36
Product: Dataease [{8}]FIVE. Written by Bill Nicholson 21/12/14 at 08:24:51
Product: Dataease [{8}]FIVE. Written by DataEase 21/12/14 at 14:41:37
Product: Dataease [{8}]FIVE. Written by DataEase 21/12/14 at 14:41:59
Product: Dataease [{8}]FIVE. Written by DataEase 21/12/14 at 16:20:51
Product: Dataease [{8}]FIVE. Written by Bill Nicholson 21/12/14 at 16:57:32
Product: Dataease [{8}]FIVE. Written by DataEase 21/12/14 at 18:18:00
Product: Dataease [{8}]FIVE. Written by DataEase 13/02/15 at 18:13:40
Product: Dataease [{8}]FIVE. Written by Marco Marchesi 27/02/15 at 09:53:56
Product: Dataease [{8}]FIVE. Written by DataEase 08/07/13 at 12:20:13