// Export By Date // DOORS - %full_filespec: exportByDate.dxl~8.1.1:dxl:ERS#1 % %date_created: Mon Jun 4 10:45:00 2012 % /* A function which exports all objects last modified between two dates */ DB db = create "Date/Time Chooser" //Creates a date/time picker dialog box called 'db' Date init = dateOnly(today) //Selects starting date for the selector box as the current date label(db,"Start Date:") //Creates a label for the selector box which says "Start Date" beside db //Puts the label next to the Start Date box. DBE picker = date(db, 30, init, true) //Creates the "Start Date" selector box. ('db' puts the selector box in the dialog box called 'db', '30' is the length (in characters) of the selector box, //'init' sets the initial value to the 'init' value, which is the current date, 'true' allows there to be a drop-down calendar to select the day. label(db,"End Date:") //Creates a label called "End Date" beside db //Puts the label next to the End Date box. DBE dates = date(db, 30, init, true) //Creates the "End Date" selector box. Values mean the exact same as they did for the "Start Date" selector Box. Date a //Creates two "Date" variables, a and b. Date b bool checkIt = false //Creates a true/false variable called "check" string typeStr = "a" //Creates a string variable called "typeStr" Object o //Creates an Object called "o" Object c //Creates an Object called "c" Module l //Creates a module called "l" which will eventually be the current module string forms[] //Creates a string variable called "forms[]" DB kindBox //Creates a dialog box called "typeBox" DBE kindRadio //Creates a group of radio buttons called "typeRadio" string attempt //Creates a string called "attempt" Item i //Creates an item called "i" string itemType //Creates a string called "itemType" string modName, fullModName, modPrefix //Creates three strings, "modName, fullModName, and modPrefix void find(Date a, Date b) //Method to create the find method, which finds the objects which have been modified between the selected dates { } //End of the "find" method void check(Date a, Date b) //Method to confirm that the start date was earlier than the end date { if(a > b) //See if the Start Date was before the End Date { errorBox "End date must have occurred after start date!" //Puts out an error box because the end date happened before the start date. show db //Shows the date selection box so that the user can pick two more dates. } else //If the End Date happened after the Start Date, we will get to the "else" section { checkIt = true //Makes the variable "check" true } } //End of the "check" method void export(string n, Date a, Date b) //Creates the "export" method, which is used to export the desired module in the desired format { l = current filtering on load view "Last Modified" print a print b Date date1 = a Date date2 = b Filter f1 = attribute "Last Modified On" >= "date1" Filter f2 = attribute "Last Modified On" <= "date2" Filter f3 = f1 && f2 set(l, f3) if(n == "Microsoft Word") //Runs if the user selected to export in Microsoft Word format { eval_("#include ") //Run "Export to Word" program } else if(n == "Microsoft Excel") //Runs if the user selected to export in Microsoft Excel format { eval_("#include ") //Run "Export to Excel" program } else if(n == "Microsoft Outlook") //Runs if the user selected to export in Microsoft Outlook format { eval_("#include ") //Run "Export to Outlook" program } else if(n == "Microsoft Powerpoint") //Runs if the user selected to export in Microsoft Powerpoint format { eval_("#include ") //Run "Export to Powerpoint" program } else if(n == "RPE") //Runs if the user selected to export in Rational Publishing Engine format { eval_("#include ") //Run "Export with RPE" program } else if(n == "RPE Microsoft Word") //Runs if the user selected to export in Rational Publishing Engine Microsoft Word format { eval_("#include ") //Run "Export with RPE to Word" program } else if(n == "RPE PDF") //Runs if the user selected to export in Rational Publishing Engine PDF format { eval_("#include ") //Run "Export with RPE to PDF" program } else if(n == "RPE html") //Runs if the user selected to export in Rational Publishing Engine html format { eval_("#include ") //Run "Export with RPE to html" program } else if(n == "HTML") //Runs if the user selected to export in HTML format { eval_("#include ") //Run "Export to HTML" program } else if(n == "Plain Text") //Runs if the user selected to export in Plain Text format { eval_("#include ") //Run "Export to Plain Text" program } else if(n == "Rich Text Format") //Runs if the user selected to export in Rich Text format { eval_("#include ") //Run "Export to Rich Text Format" program } else if(n == "Spreadsheet") //Runs if the user selected to export in Spreadsheet format { eval_("#include ") //Run "Export to Spreadsheet" program } else if(n == "FrameMaker") //Runs if the user selected to export in FrameMaker format { eval_("#include ") //Run "Export to FrameMaker" program } filtering off delete(f3) } //End of the "export" method void selectMode(string typeStr) //Creates the "selectMode" method { kindBox = create("Choose Export Type") //Creates a dialog box called "kindBox" which will contain the radio selector buttons string forms[] = { "Microsoft Word", "Microsoft Excel", "Microsoft Outlook", "Microsoft Powerpoint", "RPE", "RPE Microsoft Word", "RPE PDF", "RPE html", "HTML", "Plain Text", "Rich Text Format", "Spreadsheet", "FrameMaker"} kindRadio = verticalRadioBox(kindBox, "Select the desired export file type:", forms, 2) //Creates the vertical radio box void findKind(DB kindBox) //Creates the "findKind" method { string forms[15] = { "Microsoft Word", "Microsoft Excel", "Microsoft Outlook", "Microsoft Powerpoint", "RPE", "RPE Microsoft Word", "RPE PDF", "RPE html", "HTML", "Plain Text", "Rich Text Format", "Spreadsheet", "FrameMaker"} hide kindBox //Closes the radio button dialog box int i = get kindRadio //Finds out which radio button was selected string formats = forms[i] //Gets the string value from the radio button that was selected export(formats, a, b) //Takes the collected format type and performs the "export" method on it } //End of the "findKind" method apply(kindBox, "Select", findKind) //Creates the "Select" button. When the button is clicked, it starts the "findKind" method show kindBox //Makes the "kindBox" dialog box appear } //End of the "selectMode" method void confirm(DB dbs) //Creates the "confirm" method, which operates on the dates selected { hide dbs //closes the "confirm" box hide db //closes the "date picker" box check(a,b) //Runs the "check" method if(checkIt == true) //If the check variable is true, this section of the program will be run { o = current //Loads the object if(exists attribute "Last Modified On") //Sees if the current object has an attribute called "Last Modified On" { selectMode(typeStr) //Runs the "selectMode" method } } } //End of the "confirm" method void wrong(DB dbs) //Creates the "wrong" method, which allows the user to enter new dates { hide dbs //closes the "confirm" box } //End of the "wrong" method void unzip(DB db) //Creates the "unzip" method and operates it on the dialog box 'db' { a = getDate(picker) //Get the "start date" and put it into a variable 'a'. b = getDate(dates) //Get the "end date" and put it into a variable 'b'. DB dbs = create "Confirm?" //creates the "Confirm?" dialog box to ensure that the selected dates are correct label(dbs, "The start date is " stringOf(a, "MMMM d, yyyy") ", and the end date is " stringOf(b, "MMMM d, yyyy") ". Is this correct?") //States the dates selected and asks if they are correct. DBE buttonA = ok(dbs, "Yes", confirm) //Creates the "Yes" button. When "Yes" is clicked, the 'confirm' method is run. DBE buttonB = ok(dbs, "No", wrong) //Creates the "No" button. When "No" is clicked, the 'wrong' method is run. show dbs //Makes the confirmation box ("dbs") appear } //End of the "unzip" method apply(db, "Ok", unzip) //Runs the "unzip" method when the "Ok" button is clicked show db //Makes the dialog box ("db") appear//Makes the dia