Conditional formatting in Base form?

Creating and using forms
Post Reply
ebrenna
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Conditional formatting in Base form?

Post by ebrenna »

Is it possible with conditional formatting when using a form in OpenOffice Base? I am making a task manager and when the deadline is coming up I'd like to highlite the post with a shiny red colour. I guess we need to make a macro? Or is there another way?
OpenOffice 4.1 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting in Base form?

Post by Villeroy »

No, it is not possible. A macro can do the trick for a single-record form but not for a form grid because you can not format the rows individually.
It is possible to apply conditional formatting to a spreadsheet report.
[Tutorial] Using registered datasources in Calc
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
ebrenna
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Post by ebrenna »

Thanks. It is ok that it doesn't show in the report. I can sort the data there by priority anyway. So if it is possible in a single form it is good enough for me.

I am trying to make (find and copy) a macro now, but it is difficult, as I am not skilled enough to make one myself.
OpenOffice 4.1 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting in Base form?

Post by Villeroy »

Forget macro programming. Use filters to show the records you are interested in. Or combine 2 form grids side by side with different record sets. Or use sorting. If it has to be highlighted instead of selected, then use a linked database range on a spreadsheet with conditional formatting.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
ebrenna
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Post by ebrenna »

Code: Select all

Sub toggleColor(oEv)
REM get model of calling button:
oModel = oEv.Source.getModel()
nColor = oModel.BackgroundColor
if Red(nColor) = 0 then
   nNew = RGB(255,0,0)
else
   nNew = RGB(0,255,0)
endif
oModel.BackgroundColor = nNew
End Sub
I have used this code to create a button that changes color (on and off). My goal is (was) to use this button to both show clearly to the user (me) that this issue is prioritized ("Prioritert" in Norwegian") and let the button replace the small checkbox you can see above it.

Image

But if it is impossible to add the same data to the database with the button as with the checkbox, I guess I instead have to use the methods you have already explained to me.

If there is nothing else to add to this topic, I thank you for your help.
OpenOffice 4.1 on Windows 10
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Conditional formatting in Base form?

Post by F3K Total »

Hello,
find attached an example. The only way i found, to format a formatted field column in a tablecontrol conditionaly.
R
Attachments
Conditional_formatting.odb
(12.65 KiB) Downloaded 470 times
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
ebrenna
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Post by ebrenna »

Thanks, that works in tables showing data in form view. Very good, I needed that function. :D

How I did this, after looking at your example:
In edit mode I right clicked the upper part of the table at a vacant spot and added a new column. Right clicking the new column, add new, formatted, then right click the new column and choose "Column...". Under the Data tab choose the desired field from your database. Under general edit the name and label as you wish, then click [...] next to Formatting and enter the conditional formatting you like:

Code: Select all

[<=3][RED]General;[<10][BLUE]General;General
For the check box column I changed this into:

Code: Select all

[=1][RED]General;[=0][GREEN]General;General
Note that I had to change language from Norwegian to English (USA) to make it understand the word "General" in the code. But I realized that replacing "General" with "Standard" (in my language) made it work without changing the language.

So it works, and I guess the code can have a large number of variables. In my edited code 1 gives red and General text (standard text?), 0 gives green text, and other numbers gives normal, standard text formatting.

I was not able to apply the same trick to the button color automatically by reading the data in the database, but I already have code to make it change color.

The next question is if it is possible with conditional formatting also in the generated report...? I'll let you know it I find a solution, but can manage without the report, really. Still, it was annoying with the extremely small check boxes in the report... :?

Thanks so far.
OpenOffice 4.1 on Windows 10
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Conditional formatting in Base form?

Post by F3K Total »

Hi,
with the shipped report-Builder it's not possible, but with the Oracle-Report-Builder Extension, conditional formatting can be done.
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
ebrenna
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Post by ebrenna »

Thanks. I installed it, and can see that this gives me more options. I couldn't find where I can add conditional formatting, but I will look more into it later. If you give me a hint, I will appreciate it very much.
OpenOffice 4.1 on Windows 10
F3K Total
Volunteer
Posts: 1038
Joined: Fri Dec 16, 2011 8:20 pm

Re: Conditional formatting in Base form?

Post by F3K Total »

Hi,
in Edit Mode, select a control and then Menue Format/Conditional Formatting...
R
  • MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
  • my current system
  • Windows 10 AOO, LOLinux Mint AOO, LO
ebrenna
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Post by ebrenna »

No menus are visible, for some reason. No toolbars, nothing. I can only see this:
Screen_OpenOfficeBase2.PNG
OpenOffice 4.1 on Windows 10
User avatar
charlie.it
Volunteer
Posts: 417
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy

Re: Conditional formatting in Base form?

Post by charlie.it »

ebrenna wrote:No menus are visible, for some reason. No toolbars, nothing. I can only see this
For this reason I use Libre Office with reports.
charlie
Italian AOO Admin
macOS 14 Sonoma M1: Open Office 4.1.15 - LibreOffice 7.5.7.1

http://www.charlieopenoffice.altervista.org
Post Reply