Hi all I need help with the CDR #415

Closed
eyalvo-matrix opened this Issue Jan 1, 2017 · 6 comments

Projects

None yet

4 participants

@eyalvo-matrix
Contributor

My name is Eyal
I am trying to do the following functionality

Table A
id date is_done
1 2017-02-02 0
1 2017-01-01 0
1 2016-01-01 0

Table B
id date data
1 2016-01-01 0
1 2017-01-01 0

Only when a patient have a record with the daily date in table A
then he will get an alert in the patient file
that will disappear when an entry in table B with daily date will be inserted

any idea how to do that?

@mdsupport
Contributor

As noted in other comment, create a database view like :
SELECT A.* FROM A LEFT JOIN B ON A.id=B.id AND A.date=B.date WHERE A.date=CURDATE() AND B.id IS NULL
If A.id is pid, name it so in the view.
In rules design, the view will appear as a table and rules engine will treat is as such.

No idea why there is aversion to use of database views. Standard rules should be use standard views for maximum db performance.

@eyalvo-matrix
Contributor
eyalvo-matrix commented Jan 2, 2017 edited

Thank you all for the replay
I am not sure that join will work since the functionality that I am trying to achieve is that
Daily if there is a record in A (that can be entered daily or in a week in advance)
I will see an alert that will stop when an entry in B is inserted for that day

@mdsupport
Contributor

Suggested view would show entries in A for current date where there is no entry in B (B.id IS NULL). When B is created, there will not be any result.
In any case, not trying to solve your problem based on limited understanding - just providing an approach for using CDR with data from multiple tables. You will need to figure out the actual view.
Cheers.

@bradymiller
Member
bradymiller commented Jan 2, 2017 edited

Is this related to the following PR?
#416

@bradymiller
Member

@eyalvo-matrix ,
Just checking is this issue is resolved (with the above PR link) ?
thanks, -brady

@EyalNous

Hi brady this indeed was solve with the fix in the link above , Thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment