Jump to content

ESP Condition Expressions


SJEaton

Recommended Posts

I'm so sorry I have to dash out now, but hopefully you can fathom what's needed from what I've sent.  I will log in again after 7pm to see if you've asked for anything else. Or we can pick up again first thing tomorrow,

Thanks for your help!

Sam

Link to comment
Share on other sites

Good morning @Steve Giller, this test output both values that where held in k as shown.  image.png.ebea6cabf931ad52f59febb8e5d1cddc.png

INR Star was entered in custom t field when I selected Basildon. 

image.png.134e07ba5c0d04bbb19228834fc7b03d.png

I then selected Southend and entered Datix Q in custom o.

image.thumb.png.063ff898c20491642f69e308a01bcc5e.png

This is shown in the custom fields as follows. 

image.thumb.png.919a15badfd6fe1c1fc49fbd1dba27c3.png

In this test, the email is only interested in INR Star so shouldn't present 'Southend'.  I have 3 expressions set up though so it seems it's now presenting all those that are in custom k. 

  image.png.62f1ee2de201cb80a4b762d94967251a.png

('{{.H_custom_k}}' LIKE '%Basildon%' AND '{{.H_custom_o}}' = 'INR Star') OR ('{{.H_custom_k}}' LIKE '%Basildon%' AND '{{.H_custom_t}}' = 'INR Star')

('{{.H_custom_k}}' LIKE '%Broomfield (Mid)%' AND '{{.H_custom_o}}' = 'INR Star') OR ('{{.H_custom_k}}' LIKE '%Broomfield (Mid)%' AND '{{.H_custom_t}}' = 'INR Star')

('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_o}}' = 'INR Star') OR ('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_t}}' = 'INR Star')

Maybe I need to approach this differently?

Sam

Link to comment
Share on other sites

1 hour ago, SJEaton said:

In this test, the email is only interested in INR Star so shouldn't present 'Southend'.

Why shouldn't it present 'Southend'?

('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_o}}' = 'INR Star') OR ('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_t}}' = 'INR Star')

So:

  • '{{.H_custom_k}}' LIKE '%Southend%' -> YES
  • '{{.H_custom_o}}' = 'INR Star' -> NO
  • '{{.H_custom_k}}' LIKE '%Southend%' -> YES
  • '{{.H_custom_t}}' = 'INR Star' -> YES

becomes

  • '{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_o}}' = 'INR Star' -> NO
  • '{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_t}}' = 'INR Star' -> YES

as this is testing for either being YES, it matches.

 

Link to comment
Share on other sites

5 minutes ago, Steve Giller said:

Why shouldn't it present 'Southend'?

It shouldn't present Southend as INR Star wasn't selected in custom o, which is the question that is answered if Southend is selected in custom k.  INR Star was selected in custom t which is the question that is answered if Basildon is selected in custom k.

The customer is basically asking for INR Star at Basildon, and Datix Q at Southend, so in the INR Star system access request email that generates, I'm only interested in pulling through Basildon.  There will be a Datix Q email that will need to present Southend once I get this sussed.   

So what I'm after is:

IF '{{.H_custom_k}}' CONTAINS '%Basildon%'  AND '{{.H_custom_o}}' CONTAINS 'INR Star' OR '{{.H_custom_t}}' CONTAINS 'INR Star' then present 'Basildon' in the email.

IF '{{.H_custom_k}}' CONTAINS '%Southend%'  AND '{{.H_custom_o}}' CONTAINS 'INR Star' OR '{{.H_custom_t}}' CONTAINS 'INR Star' then present 'Southend' in the email.

I tried to use CONTAINS but it didn't work.

Maybe I'm trying to be too clever?

 

Link to comment
Share on other sites

Firstly, there is no such function as CONTAINS. This is a term that is used in the UI because it's more friendly than the LIKE function that it is using behind the scenes. So using CONTAINS will never work.

Secondly, if the "Systems" question maps to Custom O for Southend and Custom T for Basildon ... why are you including both in both ESP conditions?

Thirdly, if Custom O and Custom T are both populated by checklists, then as soon as more than one is selected the '=' is going to fail and you'll need a LIKE comparison.

 

If you selected Basildon as your Primary Site would the "What hospital sites will the new joiner be accessing this system from?" question give options of Broomfield and Southend?
If so, which Custom Field would the Broomfield answers go into?

Link to comment
Share on other sites

OK, I'll try and explain.

The customer selects a primary site, and then is asked if they want access to any systems at other sites - this is custom k.  Depending on the primary site selected, custom k lists the other 2 sites, so yes a primary site of Basildon will give options for Broomfield or Southend.  Custom fields O and T are then for the relevant sites.  T is the first one listed in K and O is the second one listed in K.

I'm therefore including all 3 ESP conditions in the email template and want them only to present based on what site is relevant for when INR Star is selected.

All of what you are saying above is making me think that I can't achieve this in this way now due to how I have the questions set up in the IC 🤔.     

Link to comment
Share on other sites

You're trying to hit a moving target with your ESP conditions, which is going to cause issues.

I would suggest fixing the Custom Fields to the Sites, for example:
Basildon - Custom_P
Broomfield - Custom_Q
Southend - Custom_R

Then, regardless of the selections, you should be able to use:

Basildon:

('{{.H_custom_k}}' LIKE '%Basildon%' AND '{{.H_custom_p}}' LIKE '%INR Star%')

Broomfield:

('{{.H_custom_k}}' LIKE '%Broomfield%' AND '{{.H_custom_q}}' LIKE '%INR Star%')

Southend:

('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_r}}' LIKE '%INR Star%')

If you needed to include other systems you could add them to the expression without forgetting the brackets, for example:

('{{.H_custom_k}}' LIKE '%Basildon%' AND ('{{.H_custom_p}}' LIKE '%INR Star%' OR '{{.H_custom_p}}' LIKE '%Datix Q%'))

 

Caveat: I'm not 100% clear on how your Capture is gathering the information, so this may need tweaking.

  • Like 1
Link to comment
Share on other sites

Hi Steve, I don't have any free custom fields left to fix a custom field for each site.  The IC is also very complex and at this late stage I don't want to be mucking about with it too much as we really do want to go out to pilot asap.  

We have therefore made a decision to deal with this in the BPM for the time being, i.e. create separate email templates for each site access that generate based on a decision as to whether the system is selected with O or T being Basildon or not.

We will then return to look at the potential for using the ESP Condition post Pilot.

Thanks for your help.

Sam    

Link to comment
Share on other sites

Hi @Steve Giller

Scrap what I said earlier, I free'd up a custom field and decided to have a go at your suggestion instead.  I  made the custom fields as follows and then used the suggested expressions.

Basildon - Custom_L
Broomfield - Custom_O
Southend - Custom_T

 

Basildon:

('{{.H_custom_k}}' LIKE '%Basildon%' AND '{{.H_custom_l}}' LIKE '%INR Star%')

Broomfield:

('{{.H_custom_k}}' LIKE '%Broomfield%' AND '{{.H_custom_o}}' LIKE '%INR Star%')

Southend:

('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_t}}' LIKE '%INR Star%')

On testing, all of these seem to be working! :D

I shall therefore proceed with this approach for all relevant systems.

Thanks again

Sam

Link to comment
Share on other sites

@Steve Giller so for scenarios where certain systems require a human task to generate rather than an email, how best might I present the sites that are relevant to the system access required in the task details so the task owner knows what sites to grant access to?  

Ideally I would like to put the following in the task details but if I can't, is there another solution???

('{{.H_custom_k}}' LIKE '%Basildon%' AND '{{.H_custom_l}}' LIKE '%Eden%') THEN 'Basildon'
('{{.H_custom_k}}' LIKE '%Broomfield%' AND '{{.H_custom_o}}' LIKE '%Eden%') THEN 'Broomfield'

 

('{{.H_custom_k}}' LIKE '%Southend%' AND '{{.H_custom_t}}' LIKE '%Eden%') THEN 'Southend'
Link to comment
Share on other sites

  • 2 months later...

@Steve Giller. I have these esp conditions in an email template which seems to work MOST of the time to swap-out the banner dependent on the service.

<esp-condition contenteditable="false" expression="'{{.h_fk_servicename}}'!='Councillor Casework'"><img alt="" height="126px" src="https://lon-p01-api.hornbill.com/xxx/dav/share/img/inline/nkeS-PPnB9a?t=1669217245092" /></esp-condition>

<esp-condition contenteditable="false" expression="'{{.h_fk_servicename}}'='Councillor Casework'"><img alt="" height="126px" src="https://lon-p01-api.hornbill.com/xxx/dav/share/img/inline/a993My_OwLq?t=1675075967828" /></esp-condition>

But some of my update emails are getting no banner which implies neither of those conditions are being met (see below).

The two cases I have seen with this issue have a "?" character in the Service Name. Two questions here:

  1. Is the "?" throwing-out the esp evaluation? If so should it be doing that or should it cater?
  2. Regardless of the above, is there a general "ELSE"-type esp-condition you can suggest that ensures a given banner is always placed, even if the expression="'{{.h_fk_servicename}}'='Councillor Casework' fails to evaluate?

Example of the blue banner working;

image.thumb.png.9c797be686c5257d4f85957f722bfd7c.png

Example of the red banner working (both using this same template):

image.thumb.png.c7c216c2a62f4a1dd293bb2bce3595c0.png

Example of one with no banner:

image.thumb.png.c21095767d33c138ec7dda7f863ed3c6.png

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...