1 Reply Latest reply on Mar 12, 2009 11:38 AM by ninja

    Help to generate records

    FireFly

      Title

      Help to generate records

      Post

      Hi ,

      I need help to figure out a way to generate new records.

      I want to generate surveyids from a  ID field which itself is a calculated field(district_id&"-"school_code)

      a dialog asking how many ids do you want to create--- input the number

      enter the start number ---

      Ex:Say my ID is 1-2(district_id:1;school_code 2)

      i want to create 25 surveyids

      my start number is  30

      so my survey ids should look some thing like this,

      1-2-30

      1-2-31....1-2-55

      Hope I explained clearly.

      Any help is greatly appreciated

        • 1. Re: Help to generate records
          ninja
            

          howdy Firefly,

          welcome to the forum.

           

          This takes me back to programming a TRS-80.  Gosh, I feel old.

           

          Your captured fields from Custom Dialog being "RecQty" and "StartNum":

           

          Set Variable [$y;Table::StartNum + Table::RecQty]

          Loop

          Set Variable [$x;StartNum]

          New Record/Request

          SetField [Table::SurveyID;district_id & "-" & school_code & "-" & $x]

          Exit Loop If [$x = $y]

          Set Variable [$x;$x+1]

          EndLoop

           

          I think that's got it...does it work for what you're after?  Try it out with pauses built in to check the progress and giving yourself a bailout from the loop before you put it out for the public...