Announcement

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

    DS field name limitations?

    I am using a recent nightly of SmartClient on Firefox 10.0.2 to build an application that will enable clients to create their own database schemata (MongoDB on the back end). In setting up the code, I am trying to use a GUID as the fieldname. So, I have a DS definition that looks like this:

    Code:
    var formFieldsDS = isc.DataSource.create({
      dataFormat: "xml",
      useAllDataSourceFields: true,
      fields: [
      {
        name: "recordId",
        hidden: true,
        primaryKey: true,
        canEdit: false
      },
      {
        name: "fd206a58-c61f-4832-b0fb-ccb12889d0e0",
        title: "Name",
        type: "Text"
      },
      {
        name: "30d298c1-29b4-43db-abc2-194ddb935bc2",
        title: "Number in party",  
        type: "Number"
      }],
      dropExtraFields: true,
      recordXPath: "//record",
      operationBindings: [
      {
        operationType: "fetch",
        dataURL: domain + "form/formDataList/2"
      },{
        operationType: "add",
        dataURL: domain + "form/formDataSave/2",
        dataProtocol: "postParams"
      },{
        operationType: "update",
        dataURL: domain + "form/formDataUpdate/2",
        dataProtocol: "postParams"
      },{
        operationType: "remove",
        dataURL: domain + "form/formDataDelete/2",
        dataProtocol: "postParams"
      }]
    });
    This code works fine to submit data, and the data gets persisted to the MongoDB store, but when it attempts to retrieve the values from the store, they never populate. If I change the name value from the GUID to "firstName," and change the corresponding attribute identifier in the MongoDB source, it resolves the problem.

    Is there a restriction on the length or content of a field name? If so, what are the parameters?

    #2
    Field names must be valid identifiers. See DataSourceField.nativeName as a way of having a different DB column name.

    Comment


      #3
      Ah, yes. That makes sense. I prepended the UUID with "var_" and swapped underscores for the hyphens and it worked fine. Thanks for the super-fast response!!

      Comment

      Working...
      X