How can I create a report to show various fields based on user selecting via parameters

  • I would like to create a report that gives the user the option to select what fields they want to see on the report.

    For instance: I have a database file called Communications and they have the following fields

    Communication ID

    VisitDate,

    Visitor 1,

    Visitor 2,

    Customer 1,

    Customer 2

    Followup

    TO Revisions

    Deliverables

    I want the report to allow the user to select a date range(I know how to handle this part)

    and also have another parameter such as a check box where the user can select if they want to see Followup, Deliverables, TORevisions or even all three if they want.

    I have tried using the method of adding all columns to the report and then using the visibility hidden option. I created an expression that doesn't work exactly right.

    If the user selects just one of the three, I get an index out of bounds error but if I select 2 of the 3 or 3 of the 3, the report works.

    Here is the expression that I'm using:

    =IIF(parameters!AgendaTopics.Value(0)=1 AND parameters!AgendaTopics.Count=1,False,IIF(parameters!AgendaTopics.Count=2 AND (parameters!AgendaTopics.Value(0)=1 OR parameters!AgendaTopics.Value(1)=1),False,IIF(parameters!AgendaTopics.Count=3,False,True)))

    If i can't get this expression to work right, are there other suggestions on how to approach this problem????

  • It sounds like the array is only being populated by the selected items, so if only 1 item is selected you only have 1 value in the array. Try this:

    =IIF(Array.IndexOf(Parameters.AgendaTopics.Label(), "Followup") <> -1, False, True)

    Basically I am checking the parameter array for the value of the column name. I am using the Label property because I am assuming the Label property actually contains the text for the column name and the value has an integer or some other value. The IndexOf method returns -1 if the value searched for is not found. I did a quick test and this appears to work. Obviously you would need to duplicate the expression for each column, just changing the column name.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply