Multiple use Entity Button Caption using States

Simple just put it in a script and call it lol.

Try this

{REPORT TICKET DETAILS:[{ENTITY DATA:CreditLimit}]-[T.RemainingAmount.Sum]:(TEN.Tab=$1)  OR (TEN.Customer=$1) OR (TEN.Pager=$1) and T.RemainingAmount>0}

Blank line? Just the $5.49 above…

Not the field format is it?

Result:

Next line missing.

Oh God… The solution is really simple but I don’t want to add script support on button headers. That will recalculate anytime button repaints…

1 Like

Totally agree on that emre!
You know somehow there is no sense of satisfaction here when the Master has to pause …

I have searched many other calculation examples, even though there are not many using REPORTTICKET DETAILS: and Sum:. Seems like it should just be another calculation…

I know I can set an Account Rule by setting up an Account for the Tab which will happen as these are overnight. The issue then is display the Limit from the rule in the Button Caption? Just surprised this has not come up before…

That relates with parser. It processes report tag before processing credit limit number. if it was like

{ENTITY DATA:{REPORT BLAH}}

It would work.

JScript Expression support needed to resolve that.

Ah DANG! - have read a lot of scripts but want to avoid for now. I am not going to show that then :disappointed: as I do not wish for Clubs to require their own server farm lol just to get a nice header :smile:

Can I use Account Credit Rule and set a Value Limit there which can then be pulled into the Button Caption, Emre?

Well if it is any help I changed the syntax a little to this:

<br/>${REPORT ENTITY DETAILS:EC.CreditLimit:(EN=$1)} - {REPORT TICKET DETAILS:T.RemainingAmount.Sum:(TEN.Tab=$1) OR (TEN.Customer=$1) OR (TEN.Pager=$1) and T.RemainingAmount>0}

Replaced {ENTITY DATA:CreditLimit} with REPORT ENTITY DETAILS:x

Result:

Just can’t get the expression to evaluate - even tried using a =TN([=TN()]), recursive to TN() function but nup!
Do you think you can get the above change to work?

Also I see a good reference to this when you and @QMcKay dealt with it some months back:
http://forum.sambapos.com/t/entity-state-formatting-templates/6120/8?u=pauln

Interesting conversation :grin:

You could do the expression somewhere else and then store it in a program setting and simply use the setting tag.

Yes I was thinking that as well, kendash.

I feel, however, it would be great to solve it using the “template syntax” and it may take some changes to do. The reason why is I feel as we extend Entities using Custom Fields - these fields should be accessible in display formats etc. The next issue I am going to have is Custom Field DATE -> Expiry Date and doing some logic or display calculation. You may recall a post some weeks back we discussed loyalty points and an expiry date with the points as they are issued.

I will see what turns up with with the above latest syntax, then look at using Account Rules, and finally as you suggest use Program Settings.

Emre said the fix but he also said why he doesn’t want to allow it. We may need to find alternative route.

PS you could possibly use new ticketlister in beta version and skip the ticket template but use the new dynamic button configuration to get a lovly hack making an alternative entity grid. Buttons may not update data as expected though.

Oh you mean jscript support but heavy resource use - yes agreed.
If you recall but I had a similar “parser” issue on report tags “[ ]” not removing blanks lines when “{” & “[” were intermingled which emre fixed last version. I am sort of hoping that this is just a similar issue as from the button captions above it just matter if doing another EVAL() to get the result.

I do sort of feel it is just sequencing of evaluations and better parsing but hey I hate to see the size of the “parser LIB” now…

TicketLister, yep should of included that as another step as well :cold_sweat:

Ok, hate myself right now as I found another problem with the syntax I am using for State Display:

<bold>$1</bold><br/>Tickets: ${REPORT TICKET DETAILS:T.RemainingAmount.Sum:(TEN.Tab=$1)  OR (TEN.Customer=$1) OR (TEN.Pager=$1) and T.RemainingAmount>0}
<br/>Limit: ${ENTITY DATA:Credit Limit}

Produces this for Customer! (Hint: No Current Ticket Data)

All I can assume is 1 of three things:

  1. The Syntax (TEN.Customer=$1) is passing in “Phil Loe-01230” as the Entity Name which does not match my key to Entity “01230”; OR
  2. The Syntax above for {REPORT TICKET DETAILS:x} does not like working with Entities with Accounts?; OR
  3. Its true I have not idea and need to leave…

I have set up Customers identical to Tabs, with States and Displays. The only difference is these Customers have transactions and accounts.

[EDIT] I am using these two formats in Customer Entity wich are not used in Tabs.
Display Format: <bold>[Full Name]-[Member No]</bold>
Account Format: <b><color red>$.00</color></b>;<b><color blue>($.00)</color></b>; $0.00
Primary Key: Member No

Note: State Display Syntax is triggering as it reads the Custom Field from Customer.

Ticket Data Saved:

Comments please?
(11.30pm :tired_face:)

Oh Heck still here, talking to myself as always. So I made a change to the Display syntax:
(TEN.Customer=01230)

And got this:

So assumption (1) correct- now any suggestions on how to fix it as cannot hard code customer key into syntax…
:sleeping:

Ok here is the solution to the above last post:

<bold>$1</bold><br/>Limit: {REPORT TICKET DETAILS:[{ENTITY DATA:Credit Limit}]-[T.RemainingAmount.Sum]:(TEN.Customers={ENTITY NAME}) OR (TEN.Tabs={ENTITY NAME}) and T.RemainingAmount>0}

Notice the use of (TEN.Customers={ENTITY NAME}) as it gets around the use of field customizations using primary keys and Entity Display.
Note: V5.55 Supported Only.

Credit to @Jesse on this one…

1 Like