Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change properties of report on runtime 2

Status
Not open for further replies.

RobertoMexicali

Programmer
May 2, 2003
39
MX
Hi everybody

I have this problem:

I need to change the properties of strings on a report (change position, color, size etc)

I don't know how many strings the report must print, so i declared a local var: "estring" as array of 100 string (dim 100), i do a loop of N times and on every cycle a value must be assigned to an element of the array

The problem is that i don't know how should i change the properties of the array on runtime
i already try:

! this code doesn't do anything, but there is not
error when compiling
estring[i#]{prop:fontstyle} = FORD:Estilo
estring[i#]{prop:fontname} = FORD:Fuente
!!!!

!!!! error when compiling this
?estring_i#{prop:fontstyle} = FORD:Estilo
?estring_i#{prop:fontname} = FORD:Fuente
?estring_i#{prop:fontsize} = FORD:tamano
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!!!! this code works only when i# = 2,
?estring_2{prop:fontstyle} = FORD:Estilo
?estring_2{prop:fontname} = FORD:Fuente

any tips???
 
Hi!

You need to set SETTARGET(Report) before the property assignments and SETTARGET() after them, Or, prefix all the assignments with Report$ i.e.

Report$?estring_2{prop:fontstyle} = FORD:Estilo.

You cannot use ::

?estring[i#]{prop:fontstyle} = FORD:Estilo

or

?estring_i#{prop:fontstyle} = FORD:Estilo

as both are invalid.

However, if you use the F12 key in the report formatter and make sure that estring[1], estring[2] and estring[3] and one after another you can do this ::

SETTARGET(Report)
i# = ?estring_1
LOOP C# = i# TO (i#+2)
C#{prop:fontstyle} = FORD:Estilo
END
SETTARGET()

Regards
 
Hi ShankarJ

i'm already using the settarget command, is just that the whole code wasn't include on my post

i'll give you more information:

my application is designed for any user can add N formats of invoices (paper size, orientation, tags to be printed(customer's name, customer address, date, invoice number, etc)), every tag have X-Y position, widht height, font, size, colo etc

so, on my report i need to change the properties of the document (letter, legal, etc) and have not problem with this

but, i don't know how many tags must be printed, so i decided to put 100 strings (array "estring" of 100), and i do a loop for N tags, assign to estring[i#] and then change the properties of the string[i#] (set font and position)

this way i do only one asigment to estring[i#] and don't have to validate the number of iteration, something like:

execute i#
estring1 = tag; set font and position
estring2 = tag; set font and position

or
if i# = 1
estring1 = tag; set font and position
elseif ....

thats the way i figured it, but i accept suggests

Regards and thanks for answering



 
Hi Roberto,

Maybe a Queue is a better idea than an Array. And, in that queue store the FEQ of the Control if you are using the CREATE() to create the controls i.e.

Feq# = CREATE(0, Create:String, ?Detail)

UNHIDE(Feq#)
Feq#{prop:fontstyle} = FORD:Estilo
...

Regards
 
Roberto,

You need to understand that field equates (FEQs) are nothing more than numbers.

The syntax for FEQs for DIMensioned USE variables, use an underscore for each dimension of the array.
For example:
estring[5] becomes ?estring_5
OtherArray[1,2] becomes ?OtherArray_1_2

But for purposes of looping, again understand that
?estring_5 is a NUMBER say 42.

I'm very comfortable with property syntax, both on reports and windows. So if you're having troubles with this, then please ask for more help. Possibly with a specific example.

BTW, you can setup reports where a band is ONE badge of an N-Up page. So you don't need to create an entire page of badges, or even an entire row. Just one badge.


HTH,
Mark Goldberg
 
thanks ShankarJ and Mark with your help now i can do exactly what i wanted to, finally the code is something like this:


if imagen1 then Report$?Image1{PROP:Text} = 'img\' & clip(imagen1).

i# = 0
settarget(report,?detail)

FORD:ConseFormato = formato1
set(FORD:porConseformato,FORD:porConseformato)
loop
next(formadet)
if errorcode() or FORD:ConseFormato <> formato1 then break.

i# += 1

if FORD:EsMemo = 1
Feq# = CREATE(0, Create:text, ?Detail)
report$Feq#{prop:trn} = true
report$Feq#{prop:boxed} = true
report$Feq#{prop:use} = SourceValorEtiqueta(FORD:EtiquetaString,folio1)
else
Feq# = CREATE(0, Create:String, ?Detail)
report$Feq#{prop:text} = SourceValorEtiqueta(FORD:EtiquetaString,folio1)
end

report$Feq#{prop:trn} = true
report$Feq#{prop:hide} = false
report$Feq#{prop:xpos} = FORD:posX
report$Feq#{prop:ypos} = FORD:posY
report$Feq#{prop:width} = FORD:Ancho
report$Feq#{prop:height} = FORD:Alto
report$Feq#{prop:font} = FORD:Fuente
report$Feq#{prop:fontsize} = FORD:Tamano
report$Feq#{prop:fontcolor} = FORD:Color
report$Feq#{prop:fontstyle} = FORD:Estilo
report$Feq#{prop:fontcharset} = FORD:CharSet
if FORD:Alineacion = 'D' then report$Feq#{prop:Right} = true.
if FORD:Alineacion = 'I' then report$Feq#{prop:Left} = true.
if FORD:Alineacion = 'C' then report$Feq#{prop:Center} = true.

end

settarget

thanks again and see you on the next post
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top