4 Replies Latest reply: May 9, 2013 7:19 PM by Ingenio RSS

    Cascading selects - Duplicate output

    VANJ
      APEX 4.0.2

      Suppose I have the following 3 fields

      1. Text field X1
      2. Select list X2 - Cascading Parent is X1. LOV query references X1. Optimize refresh is Yes
      3. Select list X3 - Cascading parents are X1 and X2. LOV query references X1 and X2. Optimize refresh is No since query has appropriate NULL handling.

      What I find is that if I enter a value in X1, the generated LOV in X3 has duplicate values. When the page is refreshed, the dupes are gone!

      Digging deeper with Firefox/Firebug, it appears that after tabbing out of field X1, 3 XHR requests are generated
      1. XHR #1 - This generates a blank value for X2 as per the LOV query. So far so good.
      2. XHR #2 - This generates 3 values for X3. So far so good. Say the values are 1,2,3.
      3. XHR #3 - This generates 3 values for X3, the same 3 1,2,3. Not sure why but I guess because X3 has 2 parent items, each one generates its own change event, fine.

      The problem (I think) is that the APEX engine simply concatenates the output from XHR #2 and XHR #3 causing the final LOV for X3 to be 1,2,3,1,2,3.

      Has anyone else seen this? Any ideas on how to avoid this? Even adding a DISTINCT to the LOV query in X3 doesn't eliminate the duplicates confirming my hypothesis that the multiple parents are somehow messing up the APEX engine.

      Help? Thanks