Custom report tag in rules only "Today" data

I dont know, issue or not issue?

my custom Loyality Card (Promotions by Points) is broken.

I have done so when ordering home on ticket printed barcode.
Later, when the client is in a cafe, he can afford to charge points on his card using these tickets.
it all worked via ticket state.

but now it does not work.
since the rules can not pull out the old data.

for example, I made a test rule:



yestoday - yesterday :sweat_smile:



Hello @bezdelmax Did you really used custom report tags inside rules? :slight_smile: Yes in some cases we benefit from it to get info about open tickets but… these tags are meant to create reports and outside reporting they only fetches data from active work period. It also fetches all tickets to prepare cache for reporting. I mean it will work really inefficiently.

New implemented {REPORT SQL DETAILS} tag will better suit for that.

###Syntax:

{REPORT SQL DETAILS:<handler or sql>;<parameters,1,2>:<fields>:<expressions>}

###Sample 1

Reading values from Tickets table.

{REPORT SQL DETAILS:
  Select * From Tickets:
 F.Id,
 F.TicketNumber,
 F.TotalAmount}

###Sample 2

Reading Status state of a specific ticket.

{REPORT SQL DETAILS:
  Select TicketStates From Tickets WHERE Id=1234:
  F.TicketStates(SN=Status)S}

We have a shortcut to parse JSON here. As you know ticket states are stored in TicketStates column as JSON data. F.TicketStates(SN=Status)S syntax parses state named as Status and returns S field value.

PS: You should always use “F” as field identifier.

3 Likes

Yes, I use :grinning:

on reading ticket state inside rules worked protection against fraud with the repeated use of a single ticket.

++ in ticket state written and read information the amount of points.

tnx.
Sample 2 - good works for me :wink: