8 Replies Latest reply on Aug 28, 2015 7:50 AM by Extensitech

    FieldStyle of a repetition

    Extensitech

      I'm not sure if this is a bug, insufficient documentation or, more likely, I'm missing something.

       

      I have a layout "widget" I'm working on, which has multiple repetitions of a global field, and each repetition may have a different value list.

       

      I thought it might be nice for this particular widget (though not really critical) if I could hide fields when they were assigned to a value list, but that value list (based on related records) was empty. This would prevent, for checkboxes and radio buttons, the user seeing the "<no values defined>" message.

       

      (I understand that I could explicitly set these rules, but I'm trying wherever possible to let the widget figure out its own configuration, without having to set the value list and then adjust the hide when as well.)

       

      Anyhow, given four fields that are four repetitions of my global, each with a value list, FieldStyle returns the style (including value list) on the second repetition every time, regardless of which repetition I pass. Not the first, which I could at least understand. Further, it doesn't seem to matter the position of the second repeitition on the x, y or z axis; it seems to be referring to the first repetition of the field that was put on the layout.. Experimenting, I found that FileBounds seems to do the same thing.

       

      I can come up with plenty of other ways to make my widget do what I want, and the hiding wasn't critical anyway, but I'm wondering if I'm missing a finer point of how FieldStyle and FieldBounds work with repetitions. Can anyone shed any light on this? Perhaps it's expected functionality, but the help documentation just doesn't mention it?

       

      Chris Cain

      Extensitech

        • 1. Re: FieldStyle of a repetition
          Fred(CH)

          Since you can have two instances of the same field and the same repetition on the same layout, i am not sure how this function is supposed to work. It would be more logical (and a good feature request) to have a "ObjectStyle" parameter within the GetLayoutObjectAttribute .

           

          Moreover, the style "Popuplist" is not an information about the content of a list. So i don't see another way than use the ValueListItems function (as you initially referred to i think) :

           

          IsEmpty ( ValueListItems ( "<filename>" ; "<valuelist>" ) )

           

          As the Hiding Condition...

          • 2. Re: FieldStyle of a repetition
            Extensitech

            Yes, it is possible to have two instances of the same field with the same repetition. I'm talking about the same field with different repetitions, each with separate value lists.

             

            And yes, I would use ValueListItems to determine whether the value list (which I would get from fieldstyle) is empty or not.

             

            So, can you confirm that if you have multiple instances of the same field, with different value lists, FieldStyle and FieldBounds return the same thing regardless of the repetition you pass? I guess, like when there's more fields with the same repetition, that these functions treat all reps as the same field. :-(

             

            I agree, it would be a good getlayoutobjectattribute addition. I'd even settle for Get ( ActiveFieldStyle ).

             

            Chris Cain

            Extensitech

            • 3. Re: FieldStyle of a repetition
              user19752

              Design functions are not useful sometime, as you mentioned many instance of same field makes no sense of result.

               

              FieldNames() function has parameters as filename and "layoutname", so you can't get what fields are in a "table" some case (if table has a same name of layout and the table is not primary).

              • 4. Re: FieldStyle of a repetition
                BruceRobertson

                I think your assumption about relationships involving repeating fields isn't going to work.

                The relationship graph doesn't know anything about individual reps. They are one big bucket.

                • 5. Re: FieldStyle of a repetition
                  Fred(CH)

                  Extensitech a écrit:

                   

                  So, can you confirm that if you have multiple instances of the same field, with different value lists, FieldStyle and FieldBounds return the same thing regardless of the repetition you pass? I guess, like when there's more fields with the same repetition, that these functions treat all reps as the same field. :-(

                   

                  Yep Chris. After a rapid test, i can confirm this.

                   

                  Even if i create two distinct objects for the same field, first object displaying repetition #1 and second object displaying repetition #2, attached List1 and List2 on according objects,

                   

                  FieldStyle ( Get ( FileName ) ; Get ( LayoutName ) ; GetFieldName ( Table::Field[2] ) )

                  is returning  :

                  "Popuplist List1"

                   

                  However,

                   

                  FieldNames ( Get ( FileName ) ; Get ( LayoutName ) )

                  is returning  :

                  Table::Field[1]¶Table::Field[2]

                   

                  So repeating fields seem not supported by FieldStyle function or it is a bug. You can try Report an Issue...

                  • 6. Re: FieldStyle of a repetition
                    Benjamin Fehr

                    This meets my experiences, that relationship uses all repetitions of key_field.

                    I use to have 1 relationship model with a rep_field with 2 repetitions as primary key.

                    Though a relationship is given when even 1 of the 2 values of rep_field/_pk matches the foreign key of the corresponding table.

                    • 7. Re: FieldStyle of a repetition
                      Fred(CH)

                      Yes, and it could be very handy, acting as a "OR" to establish the relationship.

                      With that said, it behaves similarly as multiple values separated by a ¶ in a unique repetition field.

                      • 8. Re: FieldStyle of a repetition
                        Extensitech

                        I didn't mean to imply anything about relationships, except that the value lists are from related records. Those relationships aren't based on the field I'm trying to get the style from. Sorry if I wasn't clear, there, Bruce.

                         

                        Cain