Faster Entity State Display Format for Table Captions

Credit goes to @Jesse for the idea.

Using entity state display formatting with reporting tags will slow down SambaPOS significantly if there are many active entity states on a single entity screen. This alternative method of displaying table captions is significantly faster as it retrieves the data locally instead of from the database every time the entity screen is refreshed.

Notes: You need to be at least SambaPOS 5.3.6 for this to work as this method uses a recently introduced Ticket Created User column. This guide assumes you are using the default Tables entity type and Status entity state.

Step 1. Entities Manage > Entities > Entity Types > Tables > Custom Fields

Add two custom fields to Tables entity type: User and Tickets.

Step 2. Automation Manage > Automation > Actions
Create Update Entity Data action with the following fields:

Action Name: Update Entity Data Tables User
Entity Type Name: Tables
Field Name: User
Field Value: [:TicketCreatedUser]

Step 3. Automation Manage > Automation > Actions
Create another Update Entity Data action with the following fields:

Action Name: Update Entity Data Tables Tickets
Entity Type Name: Tables
Field Name: Tickets
Field Value: [:TicketsOnTable]

Step 4. Automation Manage > Automation > Rules

Create rule with After Ticket Closing event with the following fields:
Rule Name: Update Table Entity Data - User and Tickets
Custom Constraint: Total Amount Greater 0
Select Actions: Update Entity Data Tables User and Update Entity Data Tables Tickets
TicketCreatedUser: {REPORT TICKET DETAILS:T.CreatedUserName:T.Id={TICKET ID}}
TicketsOnTable: {REPORT TICKET DETAILS:T.Count:(TEN.Table={ENTITY NAME:Tables}) and T.RemainingAmount!=0}

Step 5. States Manage > Settings > States
Add the following to the Display Format field to the following states:New Orders and Bill Requested:

<bold>$1</bold> {ENTITY DATA:User}<br/><size 20>⏱{ENTITY STATE MINUTES:Status} 🧾{ENTITY DATA:Tickets}</size>

Step 6. Test and modify to your liking.
Feel free to add any suggestions or improvements.

5 Likes

Nice tutorial but aren’t odd-numbered releases beta only?

1 Like

You’re right; 5.3.7 isn’t public. Looks like the change log for 5.3.6 includes the Created User column so that version should work with this guide.

Nice catch, I’ve updated the post.

1 Like