12 Replies Latest reply on Sep 27, 2011 11:18 AM by philmodjunk

    creating different size scale

    Malibux14x

      Title

      creating different size scale

      Post

      Hi i have a PO for clothing.  there are two size runs.  one for men (S,M,L,XL,2XL,3XL)and one for women (XS,S,M,L,XL).

      instead of having both just listed on the PO with another field indicating which is which, i want to create a field on the record where if it is blank (default) the rows will real the men's scale.  if there is a "A" in the box, then it will change to the women's scale.

       

      when i open a new record it will be defaulted as men size unless i add the A

       

      i tried creating script and it sorta works.  when the field "size run" is blank, and i hit a button, the 6 fields  (Size1 1 -6) fills with the 6 men's sizes.  when i put an A in the "size run" field and hit the button, it changes to the women's scale.  however when i change records the next record reads what the last one read.

       

      how do i fix this.

       

      see script attatched.

      size_scale.JPG

        • 1. Re: creating different size scale
          philmodjunk

          Were you aware that Replace Field Contents updates the specified field with the specified value in all the records in your current found set? That means each such step in your script might modify that field for up to every record in your table.

          How do you use this "size run" data?

          If it's just for display, I'd be inclined to set up this single calculation field:

          If ( size Run = "A" ; "S, M, L, XL" ; "S, M, L, XL, 2XL, 3XL" )

          But I suspect you have another purpose for this. Feel free to explain further if this is the case. I think we can set this up so that you don't need any scripting at all here.

          • 2. Re: creating different size scale
            Malibux14x

            I just uploaded a new photo of the PO i use.

             

            you are right, it is really just for show.  no realy function but to show which size scale i am using.

             

            when i input my sizing most of them are mens.  so i would like to keep that size scale as a default.  but it would be great to click a button and it changes to the womens scale (for the print layout too).  right now you can see there are three rows and depending on what letter i put in the pink box, it indcates the size scale.

             

            thanks for your help.

            • 3. Re: creating different size scale
              philmodjunk

              There's a bug in the forum software that I've recently reported to Modman and he's passed on the the RightNow programmers. It keeps updated images from being visible to all users and I still see the original image. Click edit post, delete the image and then click save. Click edit post again and upload the new image and I'll be able to see it.

              Chances are that we can modify the calculation to produce  a result matching what you are currently doing with the individual fields here and this makes for a simpler set up for you.

              You could also set up 6 calculation fields with if functions to display either a man's size designation or nothing depending on whether you click a check box field or not.

              The calculation for the first such field would look like this:

              If ( Not WomensSizes ; "2XL")

              Make sure that you clear the "do not evaluate if all referenced fields are empty" check box.

              (The first four fields would display the same text in both cases.)

              WomensSizes would be a number field that you place on your layout and format with a single custom value: 1. You'd then resize the field to hide the 1 and put "Woman's Sizes" next to it as layout text. Click it and the Woman's size range appears. Click it again to clear the check box and it returns to men's size ranges.

              • 4. Re: creating different size scale
                Malibux14x

                OK I UPLOADED THE NEW PHOTO AND TRIED WHAT YOU SUGGESTED.

                 

                NOW IF THE BOX HAS NOTHING IN IT IS GOES TO MENS SIZES.  IF I ERASE THE 1 IT STAYS.   DO I NEED AN "ELSE" FUNSTION IN THE CALCULATION?

                • 5. Re: creating different size scale
                  philmodjunk

                  If you leave out the else clause like I did, a null answer is returned when the expression evaluates as false and the field should then be empty. If the field is empty, you should see men's sizes. When you click the check box to enter a 1 into it, you should see Women's sizes.

                  Make sure that the "Do not evaluate if all the referenced fields are empty" check box is not selected for this calculation or it won't update correctly when you clear the check box.

                  I'd use a field of calculation for this. If you use an auto-entered calculation, you must also clear the "do not replace existing values..." check box and even then, existing records will not update to reflect changes to your calculation expression--you have to take Updating values in auto-enter calc fields without using Replace Field Contents to get them to update.

                  • 6. Re: creating different size scale
                    Malibux14x

                    the Null answer leaves the field as mens sizing.  but if i put a 1 in the field, it dissapeers.

                    • 7. Re: creating different size scale
                      Malibux14x

                      where would i use a field of calculation?  i did the auto enter calc.  not sure what the other is exactly

                      • 8. Re: creating different size scale
                        philmodjunk

                        To create a calcluation field:

                        Open manage | Database | Fields.

                        Select the correct table in the table drop down.

                        Enter the name of the new field in the text box at the bottom.

                        Select Calculation in the field type box.

                        Click Create

                        the Null answer leaves the field as mens sizing.  but if i put a 1 in the field, it dissapeers.

                        This is exactly what it should do since there is no matching women's size for ths field I used for this example. (You need one such calculation field for each size in your list. If you look at the sizes, either the same size designation is shown for men and women, or no corresponding size exists for women, so your check box either empties the field so it doesn't show a size for women or it shows a size that is common to both men and women.

                        • 9. Re: creating different size scale
                          Malibux14x

                          Ok i figured out the calculation field.  thank you.

                           

                          i think i am confusing you here.

                           

                          i need this-

                          if i put a 1 in the box, the 6 boxes should read: XS,S,M,L,Xl, (blank)

                          if is is blank, it should read: S,M,L,XL,2XL,3XL.

                           

                          right now if i put a one, the 6 size boxes are just blank.

                          • 10. Re: creating different size scale
                            philmodjunk

                            Hmmm, missed the XS designation and thus thought that the first set of sizes where the same for both and you only needed to hide sizes that didn't apply to women's sizes.

                            Your field definitions should be (each line is a different calculationfield):

                            If ( Not WomensSizes ; "S" ; "XS")
                            If ( Not WomensSizes ; "M" ; "S")
                            If ( Not WomensSizes ; "L" ; "M")
                            If ( Not WomensSizes ; "XL" ; "L")
                            If ( Not WomensSizes ; "2XL" ; "XL")
                            If ( Not WomensSizes ; "3XL" )

                            The sixth field will be blank when womensSizes is selected as there is no corresponding woman's size for 3XL.

                            • 11. Re: creating different size scale
                              Malibux14x

                              perfect!

                               

                              thank you so much.

                               

                              so in the If statment, the 2nd ';' acts somewhat like an 'else?"  like if not this make___, else make ________?

                              • 12. Re: creating different size scale
                                philmodjunk

                                exactly like an "else". Like any other FileMaker function, this is something you can look up in FileMaker Help.