Hide-When question

I'm having a problem developing a hide-when formula.
I'm trying to hide part of a rich-text field called [Subtable] but in only one situation: when field [RequestStatus] = "New" AND When the document is being printed.
This field Contains a table that, for one or more cells, contains another table. this Subtable is what i am trying to hide.
possible values and states:
1. [RequestStatus]="New", Document being Read --> Show [Subtable]
2. [RequestStatus]="New", Document being Edited --> Show [Subtable]
3. [RequestStatus]="New", Document being Printed --> Hide [Subtable]
4. [RequestStatus]="In Process", Document being Read --> Show [Subtable]
5. [RequestStatus]="In Process", Document being Edited --> Show [Subtable]
6. [RequestStatus]="In Process", Document being Printed --> Show [Subtable]
7. [RequestStatus]="Complete", Document being Read --> Show [Subtable]
8. [RequestStatus]="Complete", Document being Edited --> Show [Subtable]
9. [RequestStatus]="Complete", Document being Printed --> Show [Subtable]
Thanks for your help
- Todd
irontoddAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CRAKCommented:
RT fields always cause undisired side effects on hide when formulas since they store the hide computations.
Usually it helps when RT fields are stored in a computed subform (in condition X show "A", otherwise show "B"...), but in this case..... :-((
The hide when printed option is only available as checkbox. There's no function to evaluate, like @IsDocBeingEdited. That means that its hard to combine with other formulas as a logical AND. All is does is OR: hide is <checkbox> OR <formula>. And worse: if a user presses CTRL + P, you'd probably need a refresh and once loaded, you can't change the computed subform, unless the document is re-openend.
In short: sorry, but I'm afraid there's no way!

Unless.... (meanwhile another hour has passed!)
If you split your RT field in three to lift the middle part (the subtable) out. Put #1 and #3 on a for just as you have your RT field right now.
Make a computed subform: @If(RequestStatus="New"; "SubtableHide"; "SubtableNormal")
Place a section on "SubtableHide" with the actual subtable (RT field #2?) in it. Place the hide when printed checkbox on the section header. If the header is hidden, the entire section + content will be hidden.
If you change status, you'll need to re-open the document. People will grow over that!
With the right subform loaded, the hide switch is available. The other subform lacks the hide option. The RT field itself contains no hide options to avoid any side effects.
Please let me know. I never tried this one! It might take a week or two until I can....
irontoddAuthor Commented:
CRAK,
I appreciate your feedback. Unfortunately, I dont think the second method you provided is really feasible in this case, because the subtable in question is repeating, anywhere from 1 to 100 times.
basically it's populated into EVERY cell in the last column of the main table. The main table and the subtable will also be different for every document. Well, the format will always be the same, but the data in the tables will be different. What i'm doing is actaully pulling an RTField from a template in another document when the doc is created, then expanding the main table and copying the subtable into all the necessary cells.
Now, I have almost found a workaround, but something's a little strange with this as well. Maybe you can answer this one. I've written the following code to "simulate" my original question

@Command([EditDocument];"1");
FIELD PrintSubTables:=PrintSubTables;
@If(TestCompleteStatus="New Request";@SetField("PrintSubTables";"No");@SetField("PrintSubTables";"Yes"));
@Command([RefreshHideFormulas]);
@Command([FilePrint]);
@SetField("PrintSubTables";"Yes");
@Command([RefreshHideFormulas]);
@Command([FileSave])
@Command([EditDocument];"0");

the only problem with this is that when the "script" get to the last line, it pops the "do you want to save" dialog. I cant figger out why.
Thanks again for your comments, and any further help is greatly appreciated.
CRAKCommented:
Ha ha ha.... that one keeps puzzling people!

Some commands aren't always executed in the same order as they were programmed, but always shifted to the end of the code. [FileCloseWindow] and [FileSave] are two of them, but [EditDocument] isn't.
So what happens is that you first want to set the document to readmode (where the pop-up shows), and then the save is forced.

Back in R3 ALL commands were postponed like that. The only way to get around it was by wrapping them up in a normal @-function:
   @Do( @Command([FileSave]) )
R4 and later executed the @Commands as natural as posstible (with these exeptions). To force them in R3 order (i.e. postpone all @Commands) the @PostedCommand was introduced. @Commands are still executed in their programmed order while @PostedCommands (and the exceptions) are thrown to the end of the code.

Both offer possible solutions to your problem:

...
@Do( @Command([FileSave]) );
@Command([EditDocument];"0");

or:

...
@Command([FileSave]);
@PostedCommand([EditDocument];"0");


(mind the ";" after the save!)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
irontoddAuthor Commented:
Well, you were Close.. My R5 didnt exactly like either of your options.. I actually had to:

@Do(@PostedCommand([FileSave]));
@PostedCommand([EditDocument];"0")

but hey, I appreciate it.. I had totally forgotten about those two comands.. My notes is a bit rusty.. I've been out of it for about 2 years.. and only had about a year worth of experience when i quit..

You've been a great help! Thanks!
CRAKCommented:
That's odd... I had them both working! In R5.
Anyway... good luck! Hope you'll get something going nicely there.
Thanks for the points!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.