12 Replies Latest reply on Nov 3, 2016 6:56 AM by Johan Hedman

# Hide calculation

Hi there

I have two sets of date and time fields, one with edit possibility in browse mode, the other with no edit possibility in browse mode. And these two is arraged in top of each other.

Previusly I hidden these two sets by this:

Edit set get hidden: If (Count ( Courseattendee::id )<=0 ; True)

Not edit possibility is hidden : If ( Count ( Courseattendee::id )>0 ; True )

Now I also need to hide theese two if there is a course room booked for the course. These I have almost made possible with a case (), but whene they both is empty, then it is not hiding:

Not edit possility:

Case (

IsEmpty (( Count ( kursdeltaker )) and IsEmpty ( Count ( kursrom ))) ; True ;

IsEmpty ( Count ( kursdeltaker )) ; True ;

IsEmpty ( Count ( kursrom )) ; True ;

)

• ###### 1. Re: Hide calculation

You do not need to have a If to start with, Count ( Courseattendee::id )>0 is enough

For Hide you do not do Case, you have do use AND

if you have more then one statement you need to put each one inside ( )

Each IsEmpty should just be for one field only.

IsEmpty (kursdeltaker) and IsEmpty ( kursrom )

• ###### 2. Re: Hide calculation

But I still need to evalute if both of them is empty or both of the having records?

you mean :

If (Count ( Courseattendee::id )<=0 AND Count ( course_COURSEROOM::id ) <=0

OR Count ( Courseattendee::id )<=0 OR Count ( course_COURSEROOM::id ) <=0

; True)

and for the other one :

If ( Count ( Courseattendee::id )>0  AND Count ( Courseattendee::id )>0

OR Count ( Courseattendee::id )>0 OR Count ( Courseattendee::id )>0

; True)

• ###### 3. Re: Hide calculation

You want to hide both fields if a respective attendee count is true, OR a room is booked.

So:

Count ( Courseattendee::id ) = 0 OR Count ( course_COURSEROOM::id )

and for the other one:

Count ( Courseattendee::id ) > 0 OR Count ( course_COURSEROOM::id )

Alternatively:

IsEmpty ( Courseattendee::id ) OR not IsEmpty ( course_COURSEROOM::id )

and

not IsEmpty ( Courseattendee::id ) OR not IsEmpty ( course_COURSEROOM::id )

[which is identical to 'not ( IsEmpty ( Courseattendee::id ) AND IsEmpty ( course_COURSEROOM::id ) )']

respectively.

You can use IsEmpty ( RelatedTable::relatedField) if you're not interested in the count per se, but merely want to know if there is or is not at least one related record.

• ###### 4. Re: Hide calculation

This will hide both if both is empty. need to make edit possible if both is empty

• ###### 5. Re: Hide calculation

statement AND statement will both need to be true if you want to hide.

• ###### 6. Re: Hide calculation

yes so that mean i need a case to check for every those three outcomes?

• ###### 7. Re: Hide calculation

I think I misunderstood your original requirement.

cillion wrote:

need to make edit possible if both is empty

OK, so let's think this through:

If both referenced fields are empty:

IsEmpty ( Courseattendee::id ) AND IsEmpty ( course_COURSEROOM::id )

you want to be able to edit the field — which means you do NOT want to hide the editable field object.

So the “Hide if” calc for that object is the negation of the above expression:

not ( IsEmpty ( Courseattendee::id ) AND IsEmpty ( course_COURSEROOM::id ) )

and for the non-editable field object, you'd negate that again – which simply means using the original, un-negated expression we started out with:

IsEmpty ( Courseattendee::id ) AND IsEmpty ( course_COURSEROOM::id )

All of which is hopefully what you meant in the first place …

1 of 1 people found this helpful
• ###### 8. Re: Hide calculation

You are trying to do this

Case (

IsEmpty (( Count ( kursdeltaker )) and IsEmpty ( Count ( kursrom ))) ; True ;

IsEmpty ( Count ( kursdeltaker )) ; True ;

IsEmpty ( Count ( kursrom )) ; True ;

But what you should do is just check for each one of the IsEmpty( field ).

First you check to see if both kursdeltaker and kursrom are empty, but you are using Count for some reason I do not understand why. Count will get you 0 if there is no result in that field, so just IsEmpty will handle that for you. Then you are checking for each one of them

So better do

IsEmpty( kursdeltaker ) or IsEmpty( kursrom )

will give you the result you are asking for

• ###### 9. Re: Hide calculation

But would that work if they both are true or they both is false?

• ###### 10. Re: Hide calculation

In a Hide function you are looking for when things are True.

If

IsEmpty( kursdeltaker )

is empty, meaning no kursdeltaker, then your object will be hidden. It that statement is NOT True it will check at the second statement

or IsEmpty( kursrom )

If kursrom is NOT Ture then the object will be visible for the user.

• ###### 11. Re: Hide calculation

okey the I do that:

1. IsEmpty ( KURSDELTAKER::id ) or IsEmpty ( kurs_KURSROM::id ) then this field dont show when the the kursdeltaker has records and when the kurs_KURSROM has no records.

2. not IsEmpty ( KURSDELTAKER::id ) or not IsEmpty ( kurs_KURSROM::id ) show only when both is empty2.

Nr 1 is that field that is not editble and 2 is that fields that is editble

• ###### 12. Re: Hide calculation

It behave like a If()  statement, so it reads if IsEmpty ( KURSDELTAKER::id ) then it do not continue to read. But if you have a KURSDELTAKER::id then it goes to second statement IsEmpty ( kurs_KURSROM::id ) and reads if there is any information there.

If you want to check if both are empty before you hide your object, then you use AND in between your IsEmpty ( KURSDELTAKER::id ) and IsEmpty ( kurs_KURSROM::id ) then both need to be true to hide the object