Announcement

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

    Does smartClient support composite primarykey?

    Hi Experts,

    Can I use a composite primary key to identify unique columns in a list instead of using only one field..? same question for foreign key... Otherwise, I will build a virtual field combining the composit values into one.. Please let me know.

    Other question.. How can we know what 7 version will have as features?

    Thanks
    Last edited by ammours; 7 Apr 2009, 05:00.

    #2
    Building a virtual field is the right approach (and the docs now point this out, with a sample).

    The blog post for 7.0 beta combined with the post about new stuff in SmartGWT EE (which also applies to 7.0) are the best sources for now.

    Comment


      #3
      To build a virtual field, would you use a customSelectExpression like the example in the latest Quick Start Guide that uses firstName and lastName to create a fullName?


      Code:
      <field name="fullName" customSelectExpression="CONCAT(CONCAT(firstName, ' '), lastName)"
      primaryKey="true"
      >
      
      <validators>
           <validator type="isUnique"/>
      </validators>
      
      </field>

      Comment


        #4
        That's one approach which works if you're using SQLDataSource. You can also combine the values client-side via formatters or via modifying the data delivered to the client in DataSource.transformResponse() to introduce the new virtual field.

        What approach is best depends partly on whether you need to be able to edit the composite value, and whether you care about delivering more data to the client vs having the value calculated dynamically client-side.

        Comment


          #5
          Yes I am using the SQLDataSource. I actually don't have that much data in this case, so I don't mind having the server side combining the data and sending it to the client.

          I actually do not want this field exposed in forms. I already have a firstName and lastName fields.

          My real issue is that I want the validator to enforce isUnique for the fullname so that I don't have to deal with the pop up window that indicates a duplicate entry for a key.

          BTW, thank you for your prompt response!

          Comment

          Working...
          X