
750 P.2d 464 (1988)
106 N.M. 764
In the Matter of the GRAND JURY SANDOVAL COUNTY, New Mexico.
Allen KERPAN, Petitioner-Appellant,
v.
SANDOVAL COUNTY DISTRICT ATTORNEY'S OFFICE, Respondent-Appellee.
No. 10222.
Court of Appeals of New Mexico.
January 28, 1988.
*465 Hal Stratton, Atty. Gen., Charles H. Rennick, Asst. Atty. Gen., Santa Fe, for respondent-appellee.
Randi McGinn, Albuquerque, for petitioner-appellant.

OPINION
DONNELLY, Chief Judge.
Petitioner appeals from the denial of his application for issuance of a writ of mandamus which sought to compel the district attorney to present certain evidence to the Sandoval County grand jury, to control the manner of presentation of evidence before the grand jury, and to conduct a voir dire examination of prospective grand jury members concerning their connection, if any, with Intel Corporation (Intel). On appeal, petitioner contends that the trial court's refusal to issue the writ was error. We affirm.
Petitioner was notified pursuant to NMSA 1978, Section 31-6-11 (Repl.Pamp. 1984) that he would be the target of a grand jury investigation concerning the alleged larceny of property over $20,000, and his alleged misappropriation of trade secrets belonging to Intel. See NMSA 1978, Sections 30-16-1 and -24 (Repl.Pamp. 1984), respectively. Prior to receiving notice, petitioner had been an employee with Intel. The subject matter of the grand jury investigation involved certain documents which petitioner removed from Intel's premises on his last day of employment.
Petitioner demanded that the district attorney present evidence to the grand jury: (1) indicating that petitioner had taken and passed a polygraph examination tending to show that he had not formed the specific intent necessary to commit the alleged offenses; (2) that Michael Wagener, a state's witness, could not place a monetary value upon certain of the documents seized from petitioner's custody and that Wagener believed any opinion concerning the monetary value of the documents would be speculative; (3) that Ben Harry, a state's witness, was also found to have documents belonging to Intel in his possession, and that possession of proprietary documents by Intel employees was not unusual; and (4) that Jim Bray, a security guard for Intel, had stated that he had some reservations with the way the investigation and prosecution of petitioner had been handled. Additionally, petitioner requested that the district attorney limit the state's presentation of documentary evidence to those believed to contain trade secrets, rather than present all of the documents found in petitioner's possession. Petitioner further demanded that the district attorney conduct a voir dire of prospective grand jury members concerning their possible affiliation with Intel.
Upon denial of these requests, petitioner filed an application for a writ of mandamus with the trial court, seeking to compel the *466 district attorney to perform these acts. The trial court denied the application, but ordered that the grand jury proceedings against petitioner be stayed pending this appeal.

I. PROPRIETY OF MANDAMUS
On appeal, petitioner argues that the trial court erred in refusing to issue a writ of mandamus compelling the district attorney to present the requested exculpatory evidence.
Mandamus proceedings are technical in nature. See Dumars & Browde, Mandamus in New Mexico, 4 N.M.L.Rev. 155, 158 (1974). The party seeking the writ must first file a petition or application. Id. Upon issuance of an alternative or peremptory writ, the petition or application is replaced by the writ itself. See Laumbach v. Board of County Comm'rs of San Miguel County, 60 N.M. 226, 290 P.2d 1067 (1955); Schreiber v. Baca, 58 N.M. 766, 276 P.2d 902 (1954); State ex rel. Burg v. City of Albuquerque, 31 N.M. 576, 249 P. 242 (1926). The party on whom the writ is served may then show cause by an answer. NMSA 1978, § 44-2-9.
Petitioner filed an application for issuance of the writ; however, there is neither an alternative writ nor an answer in the record before us. The statute governing the procedure for issuance of a writ of mandamus provides that no pleading or written allegation other than the writ and the answer are permitted. NMSA 1978, § 44-2-11. The case must be tried on the matters contained in the writ and the answer. Laumbach v. Board of County Comm'rs of San Miguel County; State ex rel. Heron v. Kool, 47 N.M. 218, 140 P.2d 737 (1943). Allegations of fact contained in the application or petition form no part of the writ and ordinarily cannot be considered in determining the legal sufficiency of the writ. Mora County Bd. of Educ. v. Valdez, 61 N.M. 361, 300 P.2d 943 (1956); see also Alfred v. Anderson, 86 N.M. 227, 522 P.2d 79 (1974).
In this case, respondent made no objection to treating the application as an alternative writ. Instead, the argument of both parties has focused on the sufficiency of the allegations contained in the application. We, therefore, address the merits of petitioner's claim. See State ex rel. Burg v. City of Albuquerque (when an application for a writ of mandamus has been filed and respondent appears and answers the allegations in the application, treating them as though contained in an alternative writ, the application may be treated as an alternative writ unless objection is made).
Mandamus will issue at the request of a person beneficially interested to compel the performance of an affirmative act by another, where respondent's duty to perform an act is clearly required by law and there is no other "plain, speedy and adequate remedy in the ordinary course of law." NMSA 1978, § 44-2-5; Lovato v. City of Albuquerque, 106 N.M. 287, 742 P.2d 499 (1987); State ex rel. KNC, Inc. v. New Mexico Dep't of Fin. & Admin., Property Control Div., 103 N.M. 167, 704 P.2d 79 (Ct.App. 1985). In order for mandamus to issue, however, the petitioner must establish a clear legal right to the performance of the duty sought to be enforced. Mobile America, Inc. v. Sandoval County Comm'n, 85 N.M. 794, 518 P.2d 774 (1974); see State ex rel. McElroy v. Vesely, 40 N.M. 19, 52 P.2d 1090 (1935).
Further, in order for mandamus to issue, the act to be compelled must be ministerial, constituting a nondiscretionary duty which the respondent is required to perform. Lovato v. City of Albuquerque; see Sender v. Montoya, 73 N.M. 287, 387 P.2d 860 (1963); State ex rel. Four Corners Exploration Co. v. Walker, 60 N.M. 459, 292 P.2d 329 (1956). Mandamus is a drastic remedy to be invoked in extraordinary situations, and it may not be used as a substitute for appeal. In re Grand Jury Proceedings, Vargas, 723 F.2d 1461 (10th Cir.1983), appeal after remand, In re Grand Jury Proceedings, 727 F.2d 941 (10th Cir.1984), cert. denied, Vargas v. United States, 469 U.S. 819, 105 S.Ct. 90, 83 L.Ed.2d 37 (1984). Mandamus is not proper in this case because petitioner has other adequate remedies at law and because respondent is not *467 enjoined by law with a nondiscretionary duty to perform the acts requested.

A. Adequacy of Remedy

Mandamus proceedings are governed in part by statutory provisions. See § 44-2-5. This statute provides: "[a] writ shall not issue in any case where there is a plain, speedy and adequate remedy in the ordinary course of law. It shall issue on the information of the party beneficially interested."
As shown by the record, petitioner had a plain, speedy and adequate remedy at law. Petitioner's contention that the district attorney must present the requested evidence because he is statutorily required to conduct himself in a fair and impartial manner, is subject to being tested by other forms of relief, including a motion to dismiss the indictment. See NMSA 1978, § 31-6-7 (Repl.Pamp. 1984). Further where an irregularity prejudices the grand jury proceedings, as alleged here, a writ of prohibition dismissing the indictment may properly issue. See Davis v. Traub, 90 N.M. 498, 565 P.2d 1015 (1977). Moreover, under NMSA 1978, Section 31-6-3 (Repl. Pamp. 1984), petitioner may move to quash the indictment where the grand jury is shown not to have been selected in accordance with law. See generally Ellinwood v. Morales, 104 N.M. 243, 719 P.2d 821 (Ct. App. 1986). An application for mandamus is properly denied where another plain, speedy and adequate remedy is shown to exist. § 44-2-5.

B. Duty to Perform

Ordinarily, the exercise of discretionary power or performance of a discretionary duty cannot be controlled by mandamus. State ex rel. Bird v. Apodaca, 91 N.M. 279, 573 P.2d 213 (1977); State ex rel. KNC, Inc. v. New Mexico Dep't of Fin. & Admin., Property Control Div. NMSA 1978, Section 44-2-4 limits the use of mandamus, providing that:
It may be issued to any inferior tribunal, corporation, board or person, to compel the performance of an act which the law specially enjoins as a duty resulting from an office, trust or station; but though it may require an inferior tribunal to exercise its judgment, or proceed to the discharge of any of its functions, it cannot control judicial discretion.
Thus, the act to be compelled by mandamus must be ministerial in nature. See State ex rel. Pilot Dev. Northwest, Inc. v. State Health Planning & Dev. Bureau, 102 N.M. 791, 701 P.2d 390 (Ct.App. 1985). A ministerial duty required of a public official constitutes "an act or thing which he is required to perform by direction of law upon a given state of facts being shown to exist, regardless of his own opinion as to the propriety or impropriety of doing the act in the particular case." State ex rel. Four Corners Exploration Co. v. Walker, 60 N.M. at 463, 292 P.2d at 332. Discretion, on the other hand, has been defined as the power or right conferred upon an individual to act according to the dictates of one's own judgment and conscience. See Ross v. State Racing Comm'n, 64 N.M. 478, 330 P.2d 701 (1958); Kiddy v. Board of County Comm'rs of Eddy County, 57 N.M. 145, 255 P.2d 678 (1953).
In determining whether mandamus will lie, the court must look to the purpose of the statutory scheme to discover whether the duty sought to be compelled is ministerial or discretionary. As stated in State ex rel. Sun Co. v. Vigil, 74 N.M. 766, 772-773, 398 P.2d 987, 991-992 (1965):
[I]n determining whether a provision is mandatory or directory, a reasonable construction must be given rather than one which would render the statute absurd. Generally, in considering whether a requirement of a statute is mandatory or directory, courts look to the subject matter, the importance of the requirement, and its relation to the general object intended to be secured by the act. Those directions in the statute which are not the essence of the things to be done are not commonly considered mandatory, particularly where, by failure to obey, no prejudice will result to those whose rights are protected by the statute. [Citations omitted.]
*468 Petitioner also argues that the prosecutor should have been compelled to voir dire the prospective grand jury panel. Under the record before us, respondent cannot be compelled by mandamus to voir dire the grand jury. See Apodaca v. Rodriguez, 84 N.M. 338, 503 P.2d 318 (1972); State v. Laskay, 103 N.M. 799, 715 P.2d 72 (Ct.App. 1986). Moreover, it is not required that each grand juror be free from all previous knowledge of matters brought before them. See State v. Watkins, 92 N.M. 470, 590 P.2d 169 (Ct.App. 1979). It is the district judge convening the grand jury who has general supervisory authority over the qualifications and eligibility of persons called to serve as grand jurors, not the prosecutor. NMSA 1978, § 31-6-1 (Repl. Pamp. 1984).
In dealing with the grand jury, the prosecutor's duty is to protect both the public's interest and the rights of the accused, State v. Cruz, 99 N.M. 690, 662 P.2d 1357 (1983), however, petitioner cannot compel respondent to produce certain evidence based upon his own assertion that the evidence is direct and exculpatory. Under Section 31-6-11(B), the prosecutor must exercise his judgment and determine what evidence directly negates the guilt of the accused, and mandamus does not lie to require a prosecutor to present specific evidence before a grand jury in a particular manner. Mandamus is not a method for adjudicating rights, but a method of enforcing a clear, certain and existing right. See State ex rel. State Highway Comm'n v. Quesenberry, 72 N.M. 291, 383 P.2d 255 (1963). Its purpose is to compel and not control. State ex rel. Castillo Corp. v. New Mexico State Tax Comm'n, 79 N.M. 357, 443 P.2d 850 (1968).
The function of the grand jury is to investigate and not to determine guilt or innocence. See United States v. Levinson, 405 F.2d 971 (6th Cir.1968), cert. denied, Strang v. United States, 395 U.S. 906, 89 S.Ct. 1746, 23 L.Ed.2d 219 (1969) & Howard v. United States, 395 U.S. 958, 89 S.Ct. 2097, 23 L.Ed.2d 744 (1969) & Levinson v. United States, 395 U.S. 958, 89 S.Ct. 2097, 23 L.Ed.2d 744 (1969), reh'g denied, 396 U.S. 869, 90 S.Ct. 37, 24 L.Ed.2d 124 (1969); Coleman v. State, 553 P.2d 40 (Alaska 1976); State v. Kahlbaun, 64 Haw. 197, 638 P.2d 309 (1981). Hence, petitioner does not have a clear legal right to have the grand jury investigation proceed in the same manner as a criminal trial with the full panoply of due process rights. In Buzbee v. Donnelly, 96 N.M. 692, 696, 634 P.2d 1244, 1248 (1981), our supreme court observed that traditionally courts are not authorized to interfere "with the free exercise of discretionary powers of the prosecutor in his control over criminal prosecutions." (Citing United States v. Cox, 342 F.2d 167 (5th Cir.1965), cert. denied, Cox v. Hauberg, 381 U.S. 935, 85 S.Ct. 1767, 14 L.Ed.2d 700 (1965) (emphasis added).)
In sum, although the prosecutor is required to present direct exculpatory evidence to the grand jury, he is invested with wide discretion as to the selection and presentation of evidence. Mandamus will not lie where the effect of its issuance would be to improperly limit the scope of the state's prosecutorial discretion. Cf. Crowe v. State ex rel. McCulloch, 82 N.M. 296, 480 P.2d 691 (1971).
Petitioner also complains that he was improperly restricted by the prosecutor from advising the grand jury that he had called a polygraph examiner who was available outside the grand jury room, and who could testify concerning the results of a polygraph examination performed upon petitioner. We do not reach this issue, since it was not presented to the district court for consideration. To preserve error for appeal, a party must specifically draw the trial court's attention to the alleged error and invoke a timely ruling. See State v. Aguilar, 98 N.M. 510, 650 P.2d 32 (Ct.App. 1982); see also SCRA 1986, 11-103(A).

II. CONCLUSION
The trial court's denial of the petition for writ of mandamus was proper. Oral argument is unnecessary in this case. See Garcia v. Genuine Parts Co., 90 N.M. 124, 560 P.2d 545 (Ct.App. 1977).
*469 The decision of the trial court is affirmed.
IT IS SO ORDERED.
GARCIA and FRUMAN, JJ., concur.
