Ensure qbo3 tasks occur at different times of the day - workflow

We have a Customer Outreach task that prompts an agent to call a customer. Should the customer be unreachable, we want to ensure that up to 2 subsequent calls for the same customer occur at least a day apart, and are made at a different time of the day. After 3 attempts, we're done.
How can one configure a qbo3 task to enforce this?

The key to implementing this requirement is leveraging a Workflow, in particular If/Then and Polling steps that do a bit of date calculation.
A Workflow can be used to manage this situation, with the following steps:
Step 1: First Customer Outreach (Task = Customer Outreach)
Step 2: First call before noon?
Step 3: First Wait 22 hours (Depends on Step 2 == false)
Step 4: First Wait 26 hours (Depends on Step 2 == true)
Step 5: Second Customer Outreach (Task = Customer Outreach)
Depends on Step 3 or Step 4
Step 6: Second call before noon?
Step 7: Second Wait 22 hours (Depends on Step 6 == false)
Step 8: Second Wait 26 hours (Depends on Step 6 == true)
Step 9: Second Customer Outreach (Task = Customer Outreach)
The same Customer Outreach task can be reused for steps 1, 5, and 9.
Steps 2 and 6 are If/Then steps, that use the following expression:
format:formatDate(//*[DecisionStep="First Customer Outreach"]/ActualCompletion, "hh") >= 12
where:
format:formatDate() parses a date, in this case returning only the hour (hh)
//*[DecisionStep="First Customer Outreach"]/ActualCompletion is the completion date of the first step
Steps 3, 4, 7 and 8 are Polling steps configured with and expression similar to:
format:dateDiff(//*[DecisionStep="Wait 18 hours"]/CreatedDate, "now", "hh") >= 22
For more detail on Polling steps that pause a workflow, see this post.

Related

limit results based upon 1 column

I'm a SQL newbie, any help is greatly appreciated! The id is the ID of a person that is in a program, and STI is the step ID that correlates to the ID of the step they are currently on or have completed. What I'm having a hard time figuring out is how to limit the results to only show unique Person ID's. I can't get DISTINCT to work at all.
Here is the query:
SELECT
s.[PersonAliasId] AS [id]
, s.[StepTypeId] AS [sti]
FROM
[Step] s
ORDER BY s.[PersonAliasId]
The results from the above query are:
id sti
11126 19
47331 19
66693 7
68110 19
74838 7
89867 1
89867 2
110105 19
122059 19
122059 21
130273 7
139876 19
150180 19
161929 7
165926 19
169329 19
171922 19
There are multiple steps that we are tracking for each person. When they have completed one step and then moved to another, they show in this query twice. For example, person 122059 has completed step id 19 and are currently on step id 21. I don't really care about the multiple step numbers showing, I really only need the person ID to return once. Can anyone help me figure out what I'm doing wrong?
From my understanding of your question. You only care about unique id. So you could try to use the MAX() function to get the max step for each id.
select
distinct(s.PersonAliasId) AS id,
max(s.StepTypeId) AS sti
FROM Step s
GROUP BY s.PersonAliasId
ORDER BY s.PersonAliasId
db fiddle link
Let me know if I misunderstood anything

Siddhi: Ignore duplicate events while pattern active

I have a non-occurring event pattern to detect if a certain condition happens, then alert me if that condition doesn't change within a time limit. The below query could be described as "If value 1 appears for a user, alert me if there is not a new value for that user within 5 seconds":
define stream inStream(name string, value int);
partition with (name of inStream)
begin
from every in=inStream[ value == 1 ]
-> not inStream[ not(value == 1) ] for 5 sec
select in.name, in.value
insert into outStream;
end;
This query works exactly as expected: if I don't receive a value different than 1 within 5 seconds then the query is triggered. The issue arises when there are duplicate events with the value of 1.
If I send the event {name: "bob", value: 1} every second for 10 seconds, I would like to see the query triggered twice, once at 5 seconds, and once at 10 seconds. Right now however I see the query being triggered every second starting at 5 seconds in. Essentially the query (working as it should) is starting the 5 second timer for every event with value 1 it sees. However I would like it to not start that timer (or not output at least) if there is already a timer running.
I attempted to solve this with the following query (simply adding an 'output' line):
define stream inStream(name string, value int);
partition with (name of inStream)
begin
from every in=inStream[ value == 1 ]
-> not inStream[ not(value == 1) ] for 5 sec
select in.name, in.value
output first every 5 sec
insert into outStream;
end;
I also tried output last and output all.
The queries above did not work as expected: in the case of all and last no events at all were output, in the case of first only a single event was output, not the subsequent ones after the first 5 second block passed.
Is there any way to achieve what I would like? I have a hunch that using time windows or output is the way to solve it, but so far have not been able to get it to work.
The second query in the original question ends up working as expected. I was previously on Siddhi 4.1.4. After upgrading to Siddhi 5.0.0 the query works as I wanted it to.

Crystal Report Grouping

I'm having some problems with grouping and running totals in crystal reports, I've found loads of info whilst googling but I'm looking a bit more info.
Currently I have 3 tables, jobs, times and costs, I have a running total to calculate the value of the time.hours and another for the costs.amount.
The issue I'm having is that the costs are being multiplied by the amount of time.hours records that exist.
so if a job has 3 time.hours records and there is only one record of costs.amount that
cost is being multiplied by that about of records
So what i end up with is this
Job Hours Costs
123 5 0
123 4 100
123 3 0
=========================
12 100
which is exactly right, now if i add another running total without resetting then my total ends up as
========================
12 300
I think this is happening because of the way i have them grouped but im not sure how to make them group to only job.ID
This was solved using ( ) to break the formula down
({timesheet.Time_Date} <={?timDateUJC} and {jobsheet1.Job_JobCompleted} = 0)
or
({materialcost.Inv_Date} <= {?supDateUJC} and {jobsheet1.Job_JobCompleted} = 0)

Autogenerate ID in Leads

I have 1 custom field in Leads. I want number to restart from 1 everyday. Suppose there are 8 transactions on Day 1 no should be 1,2,3,4,5,6,7,8. Next day if there are 5 then number should be 1,2,3,4,5.
we are using SugarCrm community edition
Thanks
What do you count as a transaction? Do you mean a new case is opened?
It sounds like this would be best done from a logic hook...

Get consecutive sequence number in ireport

I need to display row number sequence of each group.
I have used $V{PAGE_COUNT} and evaluation time as now
The report data that I am getting is
Group A
1.
2
3
4
...........
page ends ......
Group A
1
2
3
4
page ends ---------
Group B
1
2
3
4
5
page ends....
But my requirement is
Group A
1.
2
3
4
...........
page ends
Group A
5
6
7
8
9
page ends .......
Group B
1
2
3
4
5
page ends....
I need all rows of same group to be continuous sequence. And start sequence from 1 when group is changed
You should use the GroupName_COUNT variable in this case.
The quote from the JasperReports Ultimate Guide
When declaring a report group, the engine automatically creates a count variable that
calculates the number of records that make up the current group (that is, the number of
records processed between group ruptures).
The name of this variable is derived from the name of the group it corresponds to,
suffixed with the _COUNT sequence. It can be used like any other report variable, in any
report expression, even in the current group expression, as shown in the BreakGroup
group of the /demo/samples/jasper sample)
More info is here: Data Grouping