Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
phuelish
Contributor III
Contributor III

Setting the default value in a child list box

Hi,

I have a parameter (stand-alone) table that I use for filtering a map chart object. The basic structure is

Load Inline [

     Parent, Child

     Parent 1, Child 1

     Parent 1, Child 2

     Parent 1, Child 3

     Parent 2, Child A

     Parent 2, Child B

     ...

];

I use two list boxes to select the filters, one for Parent and one for Child. The Child list box hides any values that do not apply.

Is there a way to get the Child list box to default select the first applicable Child field value based on the Parent list box selection?

For example, when Parent 1 is selected then Child defaults to Child 1 and when Parent 2 is selected then Child defaults to Child A?

Thank you in advance for your assistance.

-Frank

1 Solution

Accepted Solutions
phuelish
Contributor III
Contributor III
Author

I'm not sure if this is the best way to do this, but I figured out a workaround...

In the load script, I added a field to the parameter table (Actual field names use this time):

Segment_Parm:

LOAD

    RowNo() as pSeg_Temp,

    pSegment,                                // the parent field

    pSegment_Text,

    pSeg_Detail,                              // the child field

    pSeg_Detail_Text,

    ...

I then created an indexing table to get the row number for the first occurrence of each parent:

Segment_Index:

NoConcatenate Load

pSegment as pSeg_Parent,

Min(pSeg_Temp) as pSeg_Child

Resident Segment_Parm

Group by pSegment;

Then, I set the default field value to:

=FieldValue('pSeg_Detail_Text',FieldValue('pSeg_Child',FieldIndex('pSeg_Parent',Only(pSegment))))

If there's a more eloquent way to do this, I'm happy for any guidance you can provide. This feels more like a workaround than a success at this point, but it got me where I wanted to go.

View solution in original post

2 Replies
phuelish
Contributor III
Contributor III
Author

I'm not sure if this is the best way to do this, but I figured out a workaround...

In the load script, I added a field to the parameter table (Actual field names use this time):

Segment_Parm:

LOAD

    RowNo() as pSeg_Temp,

    pSegment,                                // the parent field

    pSegment_Text,

    pSeg_Detail,                              // the child field

    pSeg_Detail_Text,

    ...

I then created an indexing table to get the row number for the first occurrence of each parent:

Segment_Index:

NoConcatenate Load

pSegment as pSeg_Parent,

Min(pSeg_Temp) as pSeg_Child

Resident Segment_Parm

Group by pSegment;

Then, I set the default field value to:

=FieldValue('pSeg_Detail_Text',FieldValue('pSeg_Child',FieldIndex('pSeg_Parent',Only(pSegment))))

If there's a more eloquent way to do this, I'm happy for any guidance you can provide. This feels more like a workaround than a success at this point, but it got me where I wanted to go.

phuelish
Contributor III
Contributor III
Author

Lacking any responses, I'll call this a correct answer