OK found the solution: you can not use a datbase field in the condition for hidding, instead place first a "set variable field" in the doc ( who can been changed by a value out of the datbabase) and then use the "set varable field" in de hidiing condition.

first put a "set variable field named "showing"  in the doc

make the hidding condition like showing EQ 10

macro code

sub show
oDoc = ThisComponent
oEnum = oDoc.getTextFields.createEnumeration 'Enumerate text fields.
While oEnum.hasMoreElements
thisField = oEnum.nextElement
if thisField.SupportsService("com.sun.star.text.TextField.SetExpression") and thisField.VariableName = "showing" then
   if thisfield.value = 20 then
   noshow
   exit sub
   endif
   thisField.Content =  "20"
   thisfield.currentpresentation = "20"
   thisfield.value = 20
xFields = ThisComponent.getTextFields()
xFields.refresh
oDoc.Modified = true end if
wend
end sub

sub noshow
oDoc = ThisComponent
oEnum = oDoc.getTextFields.createEnumeration 'Enumerate text fields.
While oEnum.hasMoreElements
thisField = oEnum.nextElement
if thisField.SupportsService("com.sun.star.text.TextField.SetExpression") then
   thisField.Content =  "10"
   thisfield.currentpresentation = "10"
   thisfield.value = 10
    xFields = ThisComponent.getTextFields()
xFields.refresh
oDoc.Modified = true end if
 wend
end sub


hope it helps

Fernand

Fernand Vanrie wrote:
Michael Prochaska wrote:
Michael Prochaska wrote:

OK: after seeing your code its  obvious  that  there is no problem with
the  conditional  concept but you uses a "fieldvalue"  from a databases
table who is not yet conected to the instance where your code is running
from. So the fieldvalues are unknown when running your macro and can
never math the condition. For have your job done there are a couple of
solutions
- use the mailmarge API to do the job when you wanted a printed output
- use a bunch of macro' sto connect to your database, fill the fielsd
with the correct values  and make the changes in your document

for both methods there are lots of snipets available on the web

hope it helps



ok, than my test document wasn't accurat enough.
i've already code to connect to the DB, and fill the fields with the values.

i'll send you the testdocs again with this code, if this is ok for you.
OK
thanks very much,
michael


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to