3 Replies Latest reply on Mar 28, 2011 4:35 PM by philmodjunk

    Create Default Value in Drop Down List

    EmilyShep

      Title

      Create Default Value in Drop Down List

      Post

      Hello,

      So I have 3 fields in a portal: project #, codes & hours. Project #and Codes have conditional formatting so that you can only choose codes based on ones that correspond with the project number you select.

      My question is that in some cases, there is only 1  project # and therefore I don't want to have them select it since its the only value it can be. Also, in another case I would like it to show the first project # in the list instead of showinga blank.

      Any help would be great! Thanks in advance!

        • 1. Re: Create Default Value in Drop Down List
          philmodjunk

          To enter the first value as an automatic default value, Specify a sort order on the relationship defining the conditional value list that sorts the records into the same order as your value list. Then you can use the looked up value auto enter field option to enter the value of the first related record in this table.

          If you only want to enter this value if there is only one value in the list, use the same relationship options and do this as an auto-entered calcualtion:

          IF ( Count ( valueListTable::value ) = 1 ; valueListTable::Value )

          Leave the "do not replace existing value...." option selected so that this only enters data if the field is empty.

          • 2. Re: Create Default Value in Drop Down List
            EmilyShep

            I should have probably explained myself a little better. There is multiple values but they might all be the same...

            For example:

            Project Number              Codes

            1000                             220

            1000                             225

            1000                             340

            BUT there could be multiple project numbers with associated codes. I just want to avoid having the field empty if someone only has codes for 1 project number. The count equation doesn't work because there is more than one value they are just the same. I played around with the equation (using an extremely round about equation AVG * COUNT =SUM haha) but I can't get it to populate the field. I also tried the lookup and it didn't work either.

            • 3. Re: Create Default Value in Drop Down List
              philmodjunk

              I think codes should be in their own table where duplicates (at least for a given project) are not permitted. This is what I assumed and I don't see why this is not the case here.

              For Project Number = 1000, No value entered as there are more than one code record related to it.

              IF you have this data:

              Project Number              Codes

              1000                             220

              1000                             225

              1000                             340

              1001                             220

              Using count as I described earlier, a new record with Project #1001 would auto-enter a 220 as it is the only available number for 1001.

              If you do have 220 entered more than once for project # 1001, then you'd need to count the values in the actual value list:

              ValueCount ( ValueListItems ( Get ( FileName ) ; "valuelistnameinquotes" ) ) = 1 will be true if there is only one value available in the value list.