[Thread Prev][Thread Next][Index]

Re: a reverse "mutliselect" on a NetCDF file?



Jerome,

The LAS machinery is not set up to accept an array of values attached to a menu item.  So there is no way to have the behavior you want automagically.

However, you can still get the behavior you want if you're willing to tweak the perl based database drivers.  If you look in las/xml/perl/TMAP/insitu.pl for the getTextConstraint() method you will see that each constraint is obtained from the incoming request (created by the user interface) as an array of three values:  name,operation,value.  How these are used in creating the database query is database specific, so each driver has it's own addConstraint() method.  Inside of this method, a person has total control over how the incoming (name,operation,value) is converted into a string that will be part of the database query.  In your case, you could create a new database driver for your dataset as described in the documentation
http://ferret.pmel.noaa.gov/LASdoc/serve/cache/25.html
and inherit all of the standard methods except for addConstraint().  In your ui.xml you'd have something that looked like this:
<menu type="constraint" name="CIMT_transects">
          <item values="1,3,5,10" >T1</item>
          <item values="2,4,6,8"  >T2</item>
          <item values="......">T3</item>
          <item values="......">T4</item>
          <item values="......">T5</item>
          <item values="......">T6</item>
          <item values="......">T7/item>
</menu>
Inside of the addConstraint() method in your custom database driver, you could filter on name="gridID" and, only in this case, split the value string on commas and then replicate " AND WHERE gridID=val" for each element in your value string.

It sounds a little complicated if you haven't written your own database driver but it's really not that bad and will give you exactly the functionality you want.

As is usually the case in LAS, if you want behavior that's not already configurable you'll need to do a little extra work but there is always a solution!

Let me know if you need any extra coaching on this.


-- Jon


Jerome King wrote:
Hi all!

I have a question about being able to do a "multiselect" on a NetCDF file (through a database).
In LAS, you can use the "multiselect" attribute in the "constraint" element.

For example:

Some of the data I use is collected along "transects".
If the user wants to query data on a specific transect, then I have a constraint that allows the user to pick a specific transect and the "multiselect" tool allows the user to select more than one transect.

Now, I am interested in doing the opposite operation, where, when the user selects one transect, it selects multi IDs in the NetCDF. This is because one transect can have several IDs depending on when the cruise happened.

So I want to do something that looks like this:

<menu type="constraint" name="CIMT_transectText">
           <item values="gridID">Single transect</item>
</menu>
<menu type="constraint" name="CIMT_transectOps">
          <item values="=">=</item>
</menu>
<menu type="constraint" name="CIMT_transects">
          <item values="1", "3", "5", "10" >T1</item>
          <item values="2", "4", "6", "8"  >T2</item>
          <item values="......">T3</item>
          <item values="......">T4</item>
          <item values="......">T5</item>
          <item values="......">T6</item>
          <item values="......">T7/item>
</menu>

Is there a way to do this?

Thanks,
Jerome.



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement