Index: trunk/ippTools/src/releasetool.c
===================================================================
--- trunk/ippTools/src/releasetool.c	(revision 34933)
+++ trunk/ippTools/src/releasetool.c	(revision 35041)
@@ -441,13 +441,27 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
+    psMetadata *where = psMetadataAlloc();
+
+    PXOPT_COPY_STR(config->args, where, "-releaseName", "ippRelease.releaseName", "LIKE");
+    PXOPT_COPY_STR(config->args, where, "-state",       "ippRelease.state", "==");
+    PXOPT_COPY_STR(config->args, where, "-filter",      "rawExp.filter", "LIKE");
+    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin","rawExp.dateobs", ">=");
+    PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<=");
+    PXOPT_COPY_F32(config->args, where, "-fwhm_min",    "camProcessedExp.fwhm_major", ">=");
+    PXOPT_COPY_F32(config->args, where, "-fwhm_max",    "camProcessedExp.fwhm_major", "<=");
+    PXOPT_COPY_STR(config->args, where, "-exp_name",    "rawExp.exp_name", "==");
+    PXOPT_COPY_S64(config->args, where, "-exp_id",      "relExp.exp_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-chip_id",     "relExp.chip_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-cam_id",      "relExp.cam_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-warp_id",     "warpRun.warp_id", "==");
+    PXOPT_COPY_STR(config->args, where, "-chip_data_group", "chipRun.data_group", "LIKE");
+    PXOPT_COPY_STR(config->args, where, "-cam_data_group",  "camRun.data_group", "LIKE");
+    PXOPT_COPY_STR(config->args, where, "-warp_data_group", "warpRun.data_group", "LIKE");
+
+    PXOPT_COPY_STR(config->args, where, "-surveyName",  "survey.surveyName", "LIKE");
+    PXOPT_COPY_S32(config->args, where, "-rel_id",      "relExp.rel_id", "==");
+
     PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
-    psMetadata *where = psMetadataAlloc();
-
-//    PXOPT_COPY_STR(config->args, where, "-surveyName",  "surveyName", "LIKE");
-    PXOPT_COPY_STR(config->args, where, "-releaseName", "releaseName", "LIKE");
-//    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
-//    PXOPT_COPY_S32(config->args, where, "-rel_id",  "rel_id", "==");
-//    PXOPT_COPY_S64(config->args, where, "-exp_id",  "exp_id", "==");
 
     psString query = pxDataGet("releasetool_listrelexp.sql");
@@ -465,6 +479,8 @@
     if (psListLength(where->list)) {
         psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-        psStringAppend(&query, " WHERE %s", whereClause);
+        psStringAppend(&query, "\nWHERE %s", whereClause);
         psFree(whereClause);
+    } else if (where2) {
+        psStringAppend(&query, "\nWHERE ");
     } else {
         psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required\n");
