Announcement

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

    displayField makes a join?

    If I have the following:
    <field name="f_klassenlehrer"/>
    <field name="f_klassenlehrer_text" customSelectExpression="case when ..." />

    No join is being made. This is what I want in this case. I don't have more fields (no foreignKey, etc).

    By just adding "displayField" to <field name="f_klassenlehrer"/>, i.e.: <field name="f_klassenlehrer" displayField="f_klassenlehrer_text"/>, a join is being made.
    Why ? By reading the docs I see:

    displayField:
    Name of another field in this DataSource that should be used as the display value for this field.
    Typically used for editable foreignKey fields:

    I understand this as "typically, but not always", so I thought this can be used without joins. Is this incorrect?

    Using smartgwt 6.0p power

    #2
    I just noticed that my datasource has autoDeriveSchema="true". If I change this to false, no join is being made with
    <field name="f_klassenlehrer" displayField="f_klassenlehrer_text"/>.

    Is this a bug or is this intended behavior?

    Comment


      #3
      This is correct behavior. AutoDeriveSchema can pick up relationships from the DB schema. If you are specifying fields manually you likely don't want to enable that setting.

      Comment


        #4
        Hi Isomorphic,

        I specify *some* fields manually, the rest should be automatic, as you have recommended in the past. For example, for fields of the type of:
        <field name="f_archiv" type="boolean" sqlStorageStrategy="number" />
        where the sqlStorageStrategy must be specified manually.

        What I don't understand is why a relationship is being picked up only by the "displayField" value. What has a display field to do with foreign keys (if not using a foreign key using the foreignKey attribute) ?
        Resumed:

        Autoderiveschema=false:
        a) <field name="f_klassenlehrer" />: no relationship being picked up
        b) <field name="f_klassenlehrer" displayField="f_klassenlehrer_text"/>: no relationship being picked up

        Autoderiveschema=true:
        c) <field name="f_klassenlehrer" />: no relationship being picked up
        d) <field name="f_klassenlehrer" displayField="f_klassenlehrer_text"/>: a foreign key relationship being picked up

        Why do you have a foreign key relationship being picked up in d) *only because the displayField* ?
        In c) I also have autoderiveschema=true: why is the relationship not being picked here?

        Comment


          #5
          If your displayField ("f_klassenlehrer_text") is an includeFrom field, which it presumably must be, then setting it as the displayField for a field that is being fetched implies that this field is also needed, even if not specified in dsRequest.outputs. In that situation, setting displayField can and should result in a join.

          If this isn't your situation, show more of your DataSource. Oddly, you haven't shown us any of your FK fields, or shown what kind of join is being generated. Obviously if a join is being generated successfully there are some relations to other tables involved, and we can only explain the behavior if we have the whole picture.

          Comment

          Working...
          X