using two columns for a parameter

BIRTigo
edited February 11, 2022 in Analytics #1
Hi,

I'm new to BIRT 2.1.

For example I have a table with the following data:

id | Source IP | Destination IP | Date
===|======== |=========== |========
1 |10.20.30.1 | 172.165.2.3 | 5/25/2008
2 |10.20.30.5 | 192.168.1.3 | 5/26/2008
3 |10.20.30.6 | 10.20.30.56 | 5/25/2008

Dynamically, I need to get the Source IP and the Destination IP and use both of the columns as one parameter, like a list.

Is this possible?

Comments

  • rmurphy
    edited December 31, 1969 #2
    Yes, dynamic parameters can be expressions. You can create an expression that concatenates both the source and destination IP addresses.

    Create a new parameter and select either list of combo box for the display type. Then select Dynamic and select the data source. In the expression builder for the value column, enter an expression similar to the following:

    dataSetRow["Source IP"] + dataSetRow["Destination IP"]


    Rob
  • cypherdj
    edited December 31, 1969 #3
    Just to add a bit on what Rob suggested, which is perfectly fine.

    Instead of using the expression builder, I tend to add a computed column in the data set, for instance:
    select CLASS, ID, DESCRIPTION from Role
    CLASSID = row["CLASS"] + "_" + row["ID"]

    You can then set your parameter to use row["DESCRIPTION"] as your caption and row["CLASSID"] as your value in the dropdown list.
  • BIRTigo
    edited December 31, 1969 #4
    It's like this:

    item_col1 | item_col2
    =============
    123 | 567
    555 | 123
    567 | 123
    788 | 689

    In this example, an item can be in column 1 or in column 2. so when I place it in a parameter list the two columns should be merged and it should show:
    123
    555
    567
    689
    788

    is this possible? Please help.
  • rmurphy
    edited December 31, 1969 #5
    You should handle this with a union in the query that drives the parameter list.

    select item_col1 from table1
    union
    select item_col2 from table1;


    Rob
  • BIRTigo
    edited December 31, 1969 #6
    Hi,

    Thanks Rob. It worked.