FUNCTION comboBox_getTextByItemName(fieldname, itemname)DEFINE fieldname STRINGDEFINE itemname STRINGDEFINE cb ui.ComboBox LET cb = ui.ComboBox.forName(fieldname) # add some error handling here if cb null FOR i = 1 TO cb.getItemCount() IF cb.getItemName(i) = itemname THEN RETURN cb.getItemText(i) END IF END FOR # add some error handling to cater for case where name not found RETURN ""END FUNCTION