Re: Conditional formatting




"Tim Wilson" <timothy.d.wilson@xxxxxxxxx> schreef in bericht
news:1180402789.926557.235070@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hey everyone,

I'm just getting stated with FM8.5 Advanced. I'm building a little
database app to track departmental projects and the action steps
associated with them. I've got the bulk of it done, but I've hit a
couple snags.

1. I have a button that will mark a particular project completed. In
my "Project List" layout I want the names of the projects
("project_name") to be rendered with a strikethrough effect when the
completed_project field is true. I can't seem to get the script right.
Here's what I've got:

Go to Layout["Project List" (projects)]
Show All Records
Loop
If [projects::projects_completed = 1]
Set Field [projects::name, TextStyleAdd (projects::name;
Strikethrough)]
End If
Go to Record/Request/Page [Next; Exit after last]
End Loop

2. I'd like to dynamically place a button on my layout. If I'm looking
at the list of current projects (showing only projects that aren't
completed), I want a little button next to each record that runs a
script to mark the project completed. If I'm looking at the report
with all projects displayed (including completed ones) I want a
different button to appear next to the completed projects that will
"uncomplete" it. So my report should show one of two buttons for each
record. I just don't want to display both buttons for each record
because that would be confusing. How do choose which button to display
based on the value of the "completed_project" field?

3. Finally, I have two buttons labeled "Hide Completed" and "Show All"
at the bottom of the project list report. The purpose of the buttons
is to toggle between showing all records and showing only those
projects that aren't yet completed. Can I make this a little smarter?
I only want the "Show All" button to display when I'm showing the list
of completed projects (vice versa for the other situation). Can I do
this with a single layout, or am I going to have to create two
different layouts for these two situations?

Any input would be appreciated.

-Tim


1. Although it might work in the end, I would choose a different solution.
Keep your enter/edit layout separate from your viewing layout. On the
view/layout create a calculated field that does thjis strike-trhough for
you. It will wotk right away, without having to use a timeconsuming loop all
of the time.

2. It can be done, but not very nice. Create a constant field that has the
value 1 auto-entered. Create a calculation that returns 1 as long as the
project is not completed. Create a relation between those two field. From
that relation create a small portal. Inside the portal put your button. The
button will be visible as long as the project is not completed and
disapppaer from view when it is. BUT you need to create constants and
calculations and portalls for every field you want to have checked.

3. Create a script that is called toggle_find or something.

If < Get(FoundCount) = Get(TotalRecordCount) //We have all records
Perform Find <Your settings here>
Else // We have a selection
Show All Records
End If

I have answered some question just briefly. Just ask if you need more.

keep well, Ursus



.