Conditional formatting in Base form?

Creating and using forms

Conditional formatting in Base form?

Postby ebrenna » Wed Jul 06, 2016 9:40 pm

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
ebrenna
 
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Postby Villeroy » Thu Jul 07, 2016 12:18 am

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28674
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting in Base form?

Postby ebrenna » Thu Jul 07, 2016 1:50 pm

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
ebrenna
 
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Postby Villeroy » Thu Jul 07, 2016 2:30 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28674
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Conditional formatting in Base form?

Postby ebrenna » Thu Jul 07, 2016 3:40 pm

Code: Select all   Expand viewCollapse view
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
ebrenna
 
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Postby F3K Total » Fri Jul 08, 2016 1:17 pm

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 243 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
F3K Total
Volunteer
 
Posts: 983
Joined: Fri Dec 16, 2011 8:20 pm

Re: Conditional formatting in Base form?

Postby ebrenna » Fri Jul 08, 2016 4:25 pm

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   Expand viewCollapse view
[<=3][RED]General;[<10][BLUE]General;General


For the check box column I changed this into:
Code: Select all   Expand viewCollapse view
[=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
ebrenna
 
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Postby F3K Total » Fri Jul 08, 2016 4:49 pm

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
F3K Total
Volunteer
 
Posts: 983
Joined: Fri Dec 16, 2011 8:20 pm

Re: Conditional formatting in Base form?

Postby ebrenna » Fri Jul 08, 2016 6:31 pm

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
ebrenna
 
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Postby F3K Total » Fri Jul 08, 2016 6:37 pm

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
F3K Total
Volunteer
 
Posts: 983
Joined: Fri Dec 16, 2011 8:20 pm

Re: Conditional formatting in Base form?

Postby ebrenna » Fri Jul 08, 2016 6:41 pm

No menus are visible, for some reason. No toolbars, nothing. I can only see this:

Screen_OpenOfficeBase2.PNG
OpenOffice 4.1 on Windows 10
ebrenna
 
Posts: 10
Joined: Wed Jul 06, 2016 8:20 pm

Re: Conditional formatting in Base form?

Postby charlie.it » Sat Jul 09, 2016 9:24 am

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
macOS 10.12 Sierra: Open Office 4.1.7 - LibreOffice 6.2.8

http://www.charlieopenoffice.altervista.org
User avatar
charlie.it
Volunteer
 
Posts: 366
Joined: Wed Aug 21, 2013 2:12 pm
Location: Italy


Return to Forms

Who is online

Users browsing this forum: No registered users and 1 guest