Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to include primaryKeys in export

    SmartClient Version: v9.0p_2013-11-14/PowerEdition Deployment (built 2013-11-14)

    We're using exportData and exportClientData, both of which exclude hidden primaryKey fields from the exported data. In some cases we need to include the primaryKey fields in the export. How can we do that?

    #2
    I think I just answered my own question. On the export request I'm using req.setExportFields(getExportFieldsAndPKs()) with this method for building the list of fields.

    Code:
    private String[] getExportFieldsAndPKs() {
    	LinkedHashSet<String> fields = new LinkedHashSet<String>();
    	for (String key : getDataSource().getPrimaryKeyFieldNames()) {
    		fields.add(key);
    	}
    	for (ListGridField field : getFields()) {
    		fields.add(field.getName());
    	}
    	return fields.toArray(new String[fields.size()]);
    }

    Comment


      #3
      Yup, that's correct. Beat us by a few seconds :)

      Comment

      Working...
      X