Displaying data on an unbound field

I have a form which holds several fields which are not bound to a database table, but are showing data for information purposes only.

Consider the following code snippet.

oResultSet = oStatement.executeQuery()
        if not isnull(oResultSet)then
                oResultSet.next
                sDiscountFact = oResultSet.getString(1)
                oDiscountFact = oForm.getByName("discountFact")
              oDiscountFact.TEXT = format(sDiscountFact, sFormatString2)
        end if

If the form has just been opened, the last line returns an error:
"Property or method not found: .TEXT."
If I now change the formatted field to a text box and back again to a formatted field, the problem is solved - until the form is closed and opened again.Is this a bug to be fixed soon, or is this a more permanent "feature"?

Now I changed the last line with the following:
        oDiscountFact.setString(sDiscountFact)
That produces the same error message:
"Property or method not found: setString."

I have also tried:
    oDiscountFact.BoundField.updateString(sDiscountFact)
As expected, this does not work, because the field is not bound to a database.

Is there any other alternative to display text on an unbound field, one that works correctly all the time? The solution to this problem is really important for me.

Thanks for any suggestions.
Egbert

Hi Egbert,

I suspect that the property name may be case sensitive.

I have similar code that works with "Text". Try using -
    oDiscountFact.Text = format(sDiscountFact, sFormatString2)
and see if that fixes it.

Noel

Hi Egbert,

Sounds very similar to the behaviour in bug 84069 (LibreOffice
Bugzilla), except that your's is triggered by macro.

The move to a next insertable record in the ResultSet could be the
trigger for clearing the unbound text control (see comment 5 by Robert
in the bug report above).

The workaround seems to be to put the unbound text control on a separate
form which is not a subform of the main form and which is not bound to
any data. Whether you can get this to work correctly with your macro
setup is another matter.

Alex

Always the same answer:

https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=81276&p=375294#p375294

Using the GUI, I can set the default value for an unbound text box
belonging to any form or subforme, and nothing changes this text. Then I
can inspect this text box using MRI and find out the property I need to set.

Thanks very much for your replies and your help.I couldn't quite make things work, which prompted me to take another approach. The unbounded text boxes were only to show Information
and this can also be done with labels. So I used labels. The last line of my code example would than be:
oDiscountFact.Label = format(sDiscountFact, sFormatString2)
After having made the conversion to label a thought occurred to me: The text boxes and the associated labels were both given the same name, and therefor the confusion. I am not sure, but it sounds plausible. I have been working with database front ends for about 20 years, using Rekall, and there this problem never arose.Thanks againEgbert

Always the same answer:

https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=81276&p=375294#p375294

Using the GUI, I can set the default value for an unbound text box
belonging to any form or subforme, and nothing changes this text. Then I
can inspect this text box using MRI and find out the property I need to set.