Need help with subform...please!

Hi, I know this has been discussed elsewhere in this forum, but I still cant get it to work properly. Basically, I have a form that tracks activity. at the top, is a dialog box that prompts the user to select an activity, such as Customer Demo, Education, Solution Design, Vacation, etc… There are 10 activities in the list.

I am using a Computed Subform.

For the dialog box (before the subform), I have the following formula:

activity(Field) Value formula is:

@Prompt( [OkCancelList] ; “Select Type of Activity” ; “” ; “” ; @DbLookup( “”:“NoCache” ; @DbName ; “v_keywords”; “ACTIVITY”; 2 ))

The above formula pops up the list of activities to choose from.

For the actual field, I have “Use formula for choices” and use the following formula (not sure if this is needed here, but again, not sure what I would put here then)

@DbLookup( “”:“NoCache” ; @DbName ; “v_keywords”; “ACTIVITY”; 2 )

Then, for the subform computed formula, I have the following:

@If(activity=“Solution Design”;“s_soldes”;“Customer Demonstration”;“s_custdem”;“Education”;“education”;“education”)

If I’ve done something incredibly stupid (altogether possible, since I haven’t done notes dev in years), please let me know. The only other way I know how to do this would be to create hidden when tables on the main form, but thats not preferred.

Any help is GREATLY appreciated !!!

Gary

Subject: Need help with subform…please!

Gary,

From the Notes Help Database:

Example of displaying a computed subform

In the Main Topic form of a discussion database, you want to display the NewDocSubform when a document is created and the SavedDocSubform when a saved document is opened. Each subform contains different fields and graphics. The Insert Subform formula is:

@If(@IsNewDoc;“NewDocSubform”;“SavedDocSubform”);

Note Subform formulas cannot be refreshed while the document is open.

What the Note at the end means is that you can not determine the value of the computed sub form formular after the main document is opened. The activity field needs to be set prior to the document being opened. If you set the activity field to a default value then you will see the sub form displayed in the main document. If you change the value in the activity field the new sub form will not be displayed until the main doc is closed and re-opened. You could use button with a Prompt to determine your activity, set an environment variable, compose the main doc, then use the environmet variable in you sub form formular so that you get the correct sub form when the main doc is displayed.

Hope that helps.

Andy

Subject: Re: Need help with subform…please!

Your subform formula is off.

The @If statement has the format of …

@If( condition1; value1; [ condition2; value2; condition3; value3; … ] elsevalue ).

After “s_soldes”, I don’t see a condition, nor after “Demonstration”, nor after “Education”. In fact you have an even number arguments, so I don’t know how Designer’s formula editor let you save it like that.

Subject: Need help with subform…please!

OK, thanks for the comment, but

If the @If statement has the format of …

@If( condition1; value1; [ condition2; value2; condition3; value3; … ] elsevalue ).

I had:

@If(activity=“Solution Design”;“s_soldes”;“Customer Demonstration”;“s_custdem”;“Education”;“education”;“education”)

After “s_soldes”, I don’t see a condition, nor after “Demonstration”, nor after “Education”. In fact you have an even number arguments, so I don’t know how Designer’s formula editor let you save it like that.

“Solution Design”, “Customer Demonstration”, and “Education” are the values that the user would select

(noticed that I typed it in wrong in original thread (my error and corrected on main thread), it;s “Customer Demonstration”.

s_soldes, s_custdem, and education are the subforms … so… I still don’t understand why it doesn’t work. I tried it with and without quotes surrounding the values…

If I’m being daft, please tell me what in the world I’m doing wrong, as I don’t see it …

Thanks much!

Gary

Subject: RE: Need help with subform…please!

A “condition” is an expression that returns a true/false value. In this statement:

@If(activity=“Solution Design”;“s_soldes”;“Customer Demonstration”;“s_custdem”;“Education”;“education”;“education”)

the expression “Customer Demonstration” appears in the place of a condition. “Customer Demonstration” is not a true/false value. Instead you could put activity=“Customer Demonstration” there (assuming that was what you intended to test).