Index: trunk/ippTools/src/guidetool.c
===================================================================
--- trunk/ippTools/src/guidetool.c	(revision 14023)
+++ trunk/ippTools/src/guidetool.c	(revision 18561)
@@ -61,15 +61,26 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
+    psMetadata *where = psMetadataAlloc();
+    PXOPT_COPY_STR(config->args, where, "-exp_id",        "exp_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-inst",          "camera", "==");
+    PXOPT_COPY_STR(config->args, where, "-telescope", 	  "telescope", "==");
+    PXOPT_COPY_STR(config->args, where, "-exp_type",  	  "exp_type", "==");
+    PXOPT_COPY_S32(config->args, where, "-imfiles",   	  "imfiles", "==");
+    PXOPT_COPY_STR(config->args, where, "-filter",    	  "filter", "==");
+    PXOPT_COPY_STR(config->args, where, "-recip",         "recipe", "==");
+    PXOPT_COPY_S32(config->args, where, "-guide_version", "guide_version", "==");
+    if (!psListLength(where->list)) {
+	psFree (where);
+	where = NULL;
+    }
+
     // return all guidePendingExp rows unless there CLI search options
-    psArray *guidePendingExp = guidePendingExpSelectRowObjects(
-        config->dbh,
-        config->where ? config->where : NULL,
-        0
-    );
+    psArray *guidePendingExp = guidePendingExpSelectRowObjects(config->dbh, where, 0);
+    psFree (where);
+
     if (!guidePendingExp) {
         psError(PS_ERR_UNKNOWN, false, "no guidePendingExp found");
         return false;
     }
-
     psMetadata *output = psMetadataAlloc();
 
@@ -94,11 +105,20 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
     
+    psMetadata *where = psMetadataAlloc();
+    PXOPT_COPY_STR(config->args, where, "-exp_id",        "exp_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-inst",          "camera", "==");
+    PXOPT_COPY_STR(config->args, where, "-telescope", 	  "telescope", "==");
+    PXOPT_COPY_STR(config->args, where, "-exp_type",  	  "exp_type", "==");
+    PXOPT_COPY_S32(config->args, where, "-imfiles",   	  "imfiles", "==");
+    PXOPT_COPY_STR(config->args, where, "-filter",    	  "filter", "==");
+    if (!psListLength(where->list)) {
+	psFree (where);
+	where = NULL;
+    }
+
     // return all rawScienceExp rows unless there CLI search options
-    psArray *rawScienceExps = rawScienceExpSelectRowObjects(
-        config->dbh,
-        config->where ? config->where : NULL,
-        0
-    );
-
+    psArray *rawScienceExps = rawScienceExpSelectRowObjects(config->dbh, where, 0);
+    psFree (where);
+    
     if (!rawScienceExps) {
         psError(PS_ERR_UNKNOWN, false, "no rawScienceExp rows found");
