9 Replies Latest reply: Nov 6, 2012 11:17 AM by Rebecca Molstad RSS

    Help with a new field

      ...............

        • Re: Help with a new field
          Rebecca Molstad

          You can create a new field in the script using a wildmatch function like this:

           

          If(WildMatch(Title,'*Autumn*'),'Autumn',

          If(WildMatch(Title,'*Spring*'),'Spring',

          If(WildMatch(Title,'*Summer*'),'Summer',

          If(WildMatch(Title,'*Winter*'),'Winter','None')))) as Term

           

          Then you can use the field Term as a list box like usual.

          • Re: Help with a new field
            Diego Fernando Caivano

            Hi. I would use a combination of PICK() function along with WILDMATCH() -as rebeccad correctly said- to get it.

             

            PICK(WILDMATCH(Title, '*autumn*', '*spring*', '*summer*', '*winter*'), 'Autumn', 'Spring', 'Summer', 'Winter') AS Term

             

            Same result, just a little cleaner code if you have more values to compare.

            Regards.

              • Re: Help with a new field

                Thats great guys thanks for the replies. i dont think it will work tho as there are around 200 fields, and within the fieldnames of these 200 fields it will include the 'Term' (autumn, Summer ect). so i will need the new 'Term' field to look at all of these 200 fields.

                Does that make sense?

                  • Re: Help with a new field
                    Rebecca Molstad

                    The inline load was just an example.  When you add it to your script and use the equation against whatever your field name is, it will look at every field, no matter how many you have.  If you have a sample file, it would be easier for Diego and I to show you what we mean.

                    • Re: Help with a new field

                      Rebeccad,

                       

                      in your example..

                      Data:
                      LOAD * INLINE [
                          Title
                          PupilResultsY1AutumnReadingAPS,
                          PupilResultsY1AutumnWritingAPS,
                          PupilResultsY1AutumnMathematicsAPS,
                          PupilResultsY1AutumnScienceAPS,
                          PupilResultsY1AutumnICTAPS,
                          PupilResultsY1SpringReadingAPS,
                          PupilResultsY1SpringWritingAPS,
                          PupilResultsY1SpringMathematicsAPS,
                      ];

                      Seasons:
                      LOAD *,
                      If(WildMatch(Title,'*Autumn*'),'Autumn',
                      If(WildMatch(Title,'*Spring*'),'Spring',
                      If(WildMatch(Title,'*Summer*'),'Summer',
                      If(WildMatch(Title,'*Winter*'),'Winter','None')))) as Term
                      Resident Data;
                      DROP Table Data;

                       

                      the lines   PupilResultsY1SpringReadingAPS,etc are field names not values within a field. so where you have the field name of Title, and then the data under it. its the data under it hat are my field names.

                        • Re: Help with a new field
                          Mayil Vahanan Ramasamy

                          HI

                           

                          Try like this

                           

                          LOAD *,PICK(WILDMATCH(Title, '*autumn*', '*spring*', '*summer*', '*winter*'), 'Autumn', 'Spring', 'Summer', 'Winter') AS Term  INLINE [

                              Title

                              PupilResultsY1AutumnReadingAPS,

                              PupilResultsY1AutumnWritingAPS,

                              PupilResultsY1AutumnMathematicsAPS,

                              PupilResultsY1AutumnScienceAPS,

                              PupilResultsY1AutumnICTAPS,

                              PupilResultsY1SpringReadingAPS,

                              PupilResultsY1SpringWritingAPS,

                              PupilResultsY1SpringMathematicsAPS,

                          ];