Help with Esper Querty PLEASE!!

The Forum for Non-Technical questions

Moderators: Matt, kyle, Moderators

Post Reply
AngelMerchan
Posts: 7
Joined: Fri Jan 29, 2010 4:50 am
Organization: UIS

Help with Esper Querty PLEASE!!

Post by AngelMerchan » Thu Jul 21, 2011 4:33 pm

Hello,

I'm having problems with some Esper query. Can somebody help me please.
I'm trying to insert in a Window the reader ID, tag ID, and antenna, from a group of readers when the tag leaves a reader. I need this for store the previous reader that read an specific tag. I tried it by different ways, but it doesn't work completly.

I try:
The problem with this query is that it doesn't difference between the tags, so, when I use two or more tags, in the window just save the last tag that was read. I need save an event for every diferent tag.

Code: Select all

statements.add(esperService.getProvider().getEPAdministrator().createEPL(
				"insert rstream into previousReader select tag_ID as tag_ID, reader_ID as reader_ID, antenna as antenna " +
				"from LobbyEdificio"));
also tray:
Using pattern and every-distict I try to select the information of rsteam from the LobbyEdificio window, but athough it doesn't show syntax error, it doesn't do anything. Nothing is saves in the Window previousReader.

Code: Select all

statements.add(esperService.getProvider().getEPAdministrator().createEPL(
				"on pattern[every-distinct(tag.tag_ID) tag=LobbyEdificio] " +
				"insert rstream into previousReader select tag_ID as tag_ID, reader_ID as reader_ID, antenna as antenna " +
				"from LobbyEdificio"));
I tried this way too, but the syntaxis isn't correct:

Code: Select all

statements.add(esperService.getProvider().getEPAdministrator().createEPL(
				"insert into previoustReader " +
				"select distinct by tag_ID prior(1,tag_ID) as tag_ID, prior(1,reader_ID) as reader_ID, prior(1,antenna) as antenna " +
				"from LobbyEdificio"));
and the last way I try was using "prior()" with patterns, but apparently is not possible use "prior()" with "pattern". :(

Can anybody help me plase?
Thanks for your time! Take care!

Matt
Posts: 362
Joined: Fri May 02, 2008 11:56 am
Organization: Pramari

Re: Help with Esper Querty PLEASE!!

Post by Matt » Fri Jul 22, 2011 5:16 pm

You might want to take this to the Esper forum, as I'm not entirely sure how to answer your question. The Northwind example does something quite similar to what you are trying to do, though, so I'd check that out first and see if you can modify it to fit your needs. Check the developers guide in the SDK for more information.

AngelMerchan
Posts: 7
Joined: Fri Jan 29, 2010 4:50 am
Organization: UIS

Re: Help with Esper Querty PLEASE!!

Post by AngelMerchan » Fri Jul 22, 2011 7:03 pm

Ok, I'll try in the Esper forum... I already checked the Northwind example, but this query is a little bit more tricky. I let you know how it goes.

Thanks for your time!

AngelMerchan
Posts: 7
Joined: Fri Jan 29, 2010 4:50 am
Organization: UIS

Re: Help with Esper Querty PLEASE!!

Post by AngelMerchan » Tue Aug 02, 2011 10:47 am

Good Morning...

I posted my question in an Esper Forum and they gave me a possible solution, may be it can usefull to somebody else:

"You can use the "prev" function for that, together with a "std:groupwin(tagId).win:length(2)" which instructs "prev" to use the previous per tagid.
Alternatively you can the use "last" aggregation function with "group by tagid"."

Thanks!

Angel Merchan

Post Reply

Who is online

Users browsing this forum: MichaelDuece and 4 guests