Reputation: 251
Hi I have written a query which need to show the data in drop down box. Let me share my query what i written
DEFINE TEMP-TABLE tt_seq_report.
FIELD tt_seq_report.neutral_part_obj AS DECIMAL
FIELD tt_seq_report.patt_id AS CHARACTER
FIELD tt_seq_report.npai_info2 AS CHARACTER.
EMPTY TEMP-TABLE tt_seq_report.
FOR EACH gdmf_neutral_part NO-LOCK :
FIND FIRST gdcf_part_type WHERE gdcf_part_type.part_type_obj EQ gdmf_neutral_part.part_type_obj NO-LOCK NO-ERROR.
CREATE tt_seq_report.
ASSIGN
tt_seq_report.neutral_part_obj = gdmf_neutral_part.neutral_part_obj
tt_seq_report.patt_id = gdcf_part_type.patt_id WHEN AVAILABLE gdcf_part_type
tt_seq_report.npai_info2 = gdmf_neutral_part.npai_info2.
END.
/* Written in window main block */
FOR EACH tt_seq_report NO-LOCK :
coCombo-2:ADD-LAST(tt_seq_report.patt_id).
END.
FOR EACH tt_seq_report NO-LOCK :
coCombo-3:ADD-LAST(tt_seq_report.npai_info2).
END.
/*
If you see tt_seq_report.patt_id and tt_seq_report.npai_info2 data is
i.e tt_seq_report.patt_id -BFA
tt_seq_report.npai_info2 -23
tt_seq_report.patt_id -BFA (same id)
tt_seq_report.npai_info2 -24
tt_seq_report.patt_id -SS
tt_seq_report.npai_info2 -23
tt_seq_report.patt_id -SS (same id)
tt_seq_report.npai_info2 -24
tt_seq_report.patt_id -ABS
tt_seq_report.npai_info2 -23
tt_seq_report.patt_id -ABS (same id)
tt_seq_report.npai_info2 -24
and so on.
*/
So here tt_seq_report.patt_id is same for one set of records but tt_seq_report.npai_info2 is will not be same for every records. I could use where condition if there is tt_seq_report.patt_id is BFA,SS,ABS only but it has many.
If I run this window then i can get multiple same tt_seq_report.patt_id in drop down box.
i.e once we select drop down box the showing records like below CustID(label Name for dropbox) Value(label Name for dropbox)
BFA 23 BFA 24 SS 23 SS 24 ABS 23 ABS 24
But My expected output should be
CustID(label Name for dropbox) Value(label Name for dropbox)
BFA 23 24
SS 23 24
ABS 23 24
Please help this case. Thank you.
Upvotes: 0
Views: 116
Reputation: 1498
Try this
FOR EACH tt_seq_report NO-LOCK :
If lookup(tt_seq_report.patt_id, ccombo2:list-items) = 0 then
coCombo-2:ADD-LAST(tt_seq_report.patt_id).
END.
I don't know your scope and I'm doing this on mobile, so you might need to change it to list-items in frame {&frame-name) or your real frame name, if it's not {&frame-name}.
EDIT: Since you asked for an alternative, you can also do this:
FOR EACH tt_seq_report NO-LOCK
BREAK BY tt_seq_report.patt_id:
If first-of(tt_Seq_report.patt_id) then
coCombo-2:ADD-LAST(tt_seq_report.patt_id).
END.
Upvotes: 1