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"));
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"));
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"));
Can anybody help me plase?
Thanks for your time! Take care!