Hi Hans, Thanks for reply. If I set the "view expression" as "SELECT * FROM topic_name" It will read values of all the fields in the topic. But I want to read the values of few selected fields only. In my previous mail I had mentioned that if I set the viewExpression as "SELECT userid, description FROM topicName" , even then it is reading values of all the fields in the topic. Can you please give an example for usage of the view expression to read only selected fields ?
On Thu, Jun 28, 2012 at 4:46 PM, Hans van't Hag <hans.vant...@prismtech.com>wrote: > Hi John, > > > > Here’s a code-snippet that shows how to create a dataReader: > > > > > > /* Create a Subscriber with the QoS provided. */ > > Subscriber subscriber = participant.createSubscriber("Subscriber", > sqos); > > > > /* If no ReaderQoS is provided, copy the QoS of the Topic that > we're > > * about to monitor. > > */ > > if(rqos == null){ > > rqos = > ReaderQoS.copyFromTopicQoS((TopicQoS)(topics[0].getQoS())); > > } > > > > /* Create a DataReader for the Topic with the QoS provided. > Parameters: > > * 1. Name of the DataReader > > * 2. *The 'view expression' to subscribe to the right topic. > This must* > > * * be 'select * from <topicName>' to get all data for a > topic. A* > > * * where clause can be added to apply a content filter.* > > * 3. The QoS to use for the DataReader. > > */ > > DataReader reader = subscriber.createDataReader( > > realName + "DataReader", > > "select * from " + realName, > > rqos); > > > > Please note that the C&M API rather than being a standardized API is an > internal API used primarily by our own tools. > > > > Regards, > > Hans > > > > > > * * > > *Hans van 't Hag* > > OpenSplice DDS Product Manager > > PrismTech Netherlands > > Email: hans.vant...@prismtech.com > > Tel: +31742472572 > > Fax: +31742472571 > > Gsm: +31624654078 > > > > PrismTech is a global leader in standards-based, performance-critical > middleware. Our products enable our OEM, Systems Integrator, and End User > customers to build and optimize high-performance systems primarily for > Mil/Aero, Communications, Industrial, and Financial Markets. > ------------------------------ > > *From:* developer-boun...@opensplice.org [mailto: > developer-boun...@opensplice.org] *On Behalf Of *Cristy John > *Sent:* Thursday, June 28, 2012 6:31 AM > *To:* developer@opensplice.org > *Subject:* [OSPL-Dev] datareader view expression > > > > Hi all, > > > > I am working on the Control and Monitoring API shipped with Opensplice > Community Edition V5.5.1 > > > > While creating a org.opensplice.cm.DataReader, we pass three arguments name, > view, Qos. I am not certain what is the "view". The javadoc says view is " > *The View that determines what data the DataReader reads" * > > > > What I am trying to achieve is, to filter the fields of a topic so that I > can read values of selected fields only. Suppose my topic consists of > fields [userid, description, data], I want the datareader to read values > of only userid and description. > > > > I understand that the opensplice Java API makes a JNI call to > jniCreateDataReader() to create the datareader. The documentation in the > C source files say that this view expression is a OQL expression which is a > subset of SQL SELECT statement. > > > > I tried using "SELECT userid, description FROM topicName" as the view > expression. But the datareader is not filtering the fields but reads values > of all the three fields. > > > > Can I achieve what I am trying to do ? Can somebody explain how to use the > "view expression" to filter the fields while creating a datareader using > C&M API ? > > > > Thanks & Regards > > John > > _______________________________________________ > OpenSplice DDS Developer Mailing List > Developer@opensplice.org > Subscribe / Unsubscribe > http://dev.opensplice.org/mailman/listinfo/developer > > -- Thanks & Regards John
<<image001.jpg>>
_______________________________________________ OpenSplice DDS Developer Mailing List Developer@opensplice.org Subscribe / Unsubscribe http://dev.opensplice.org/mailman/listinfo/developer