Jump to content

Turning a field on and off

This topic is 5719 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

How can i turn on (and off) a field in a calculation by using a button?

I want to be able to add a field when applicable, and turn it off when not needed. Can someone help me find a solution to this?

Thanks, Peter

Link to comment
Share on other sites

First, I deleted the duplicate post in the Articles forum, as that was the wrong place, and this is the right one. Please don't post the same thing in 2 different places. It creates confusion and makes a continuous discussion difficult. Most of use the "Recent Posts" search, so we'll see both posts.

As to your question, the technique you're looking for is often called the "visibility" trick, from the example file of the same name by John Mark Osborne.


Do a search on Resources at the above site for other variations.

He explains it well. The basic technique is based on a self-relationship, which only evaluates true under certain circumstances. The field, or object, you want to hide or show are inside a portal based on this self-relationship. You can also put other layout objects besides fields inside it. Objects inside only appear when the portal's relationship is valid.

Buttons running scripts which are not visible will not respond to a click on their former location (though the "hand" will still show; best to turn it off for such buttons).

Link to comment
Share on other sites

I downloaded the file and I am confused on how it works. I have a relational database. One table is a client database and the other is related client billing records. I show the billing records in a portal on the client database (there are many billing records per client). In the portal is Dateofbill, typeofbilling, amount, and datebillsent. if the typeofbilling is a payment I wanted to make it so the datebillsent field wouldn't show.

I suspect the Visibility trick is the way to go, but I just don't seem to understand it

Link to comment
Share on other sites

The visibility trick won't work in a portal because it uses a portal and you can't have a portal in a portal. However, a word of advice, really study it until you can understand it; it is worth its weight in gold.

A calculation is the way to go. Daniele's idea is fine but a simpler way is

to set your button to

Set Field(ShowField; Case(Payment; ""; DateBillSent))

Edited by Guest
Link to comment
Share on other sites

This topic is 5719 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.