SugarCRM Partial Uninstallation of package - sugarcrm

Need help in partially uninstall each sugarcrm package using manifest.php
I have 2 products (let's say X and Y ) ,each consists of 5 modules.
Out of 5 in X ,2 modules (let's say A and B ) are core which will required for Y.
C,D,E are related to X only.
My product will be uninstallable which will uninstall all 5 Modules, which I don't want as A and B can be Y as well.
I want to Uninstallation process don't uninstall A and B, as an instance can have my other products (Y) which need A and B.
Any clue to stop A and B if a user is going to uninstall X or Y.
Any Help will be highly appreciated.

Related

Optimize on two correlated arrays in ORTools

Is there some general rule on how to model soft constraints of correlation between two arrays of dependent variables in OR-Tools?
I am trying to solve a bit of a complex shift scheduling problem and I cannot wrap my head around it. The staff is split into two teams and the general rule is that only people from one team work except when there is a need to cover vacation or sick days. I imagine something like this:
day 1
day 2
day 3
day 4
day 5
team 1
x
x
-
-
x
team 2
-
-
x
x
-
x - work
'- - rest
and then each worker works primarily on the days where their team works except when there is a need to cover for somebody from the other team:
day 1
day 2
day 3
day 4
day 5
worker 1, team 1
x
x
-
-
x
worker 2, team 1
x
x
-
-
-
worker 3, team 2
-
-
x
x
x
worker 4, team 2
-
-
x
x
-
Notes:
day 5 is an example where worker 2 had to take day off and worker 3 from the other team covers.
there are also other complications (shifts, skills, etc.) for workers, omited for simplicity
Now if I have the below arrays, how do I tell or-tools to assign workers in the working team first and cover with others only when not possible to meet some of the other constraints, i.e. model the soft constraint between workers and teams?
team_assignments = {}
for d in range(num_days):
for t in range(num_teams):
team_assignments[d,t] = model.NewBoolVar(f'day_team:{d},{t}')
work = {}
for d in range(num_days):
for e in range(num_employees):
work[d,e] = model.NewBoolVar(f'emp_day:{e}_{d}')
In other words how do I express the penalty if workers 3 and 4 are working on days 1. 2. and 5?
Note this is doing a hard constraint where I need a soft one:
for d in range(num_days):
for e in range(num_emp):
model.Add(work[d,e] == team_assignments[d,emp_team[e]])
This seems to do the trick:
for d in range(num_days):
for e in range(num_emp):
t = emp_team[e]
works_with_other_team = model.NewBoolVar(f'emp_team:{e}_{t}')
model.Add(works_with_other_team == True).OnlyEnforceIf(work[d,e], team_assignments[d,t].Not())
obj_bool_vars.append(works_with_other_team)
obj_bool_coeffs.append(3) # pick appropriate penalty
and then minimize over var*coeff
model.Minimize(
sum(obj_bool_vars[i] * obj_bool_coeffs[i] for i in range(len(obj_bool_vars)))
)
Initially I was trying to do something like the below and it was failing
model.Add(works_with_other_team == work[d,e] & team_assignments[d,t].Not())
and when this failed with NotImplementedError: calling and on a linear expression is not supported, please use CpModel.AddBoolAnd I went on trying to implement it with AddBoolAnd or AddBoolOr but the much more elegant solution is to use OnlyEnforceIf

How to add 2 Attributes one after another in MSTR?

I am new to MSTR and trying to build a new Dossier and i got stuck on the below issue.
I have 2 attributes and 1 metric in my dataset and Attribute 1 has data A, B & C and Attribute 2 has data X, Y, Z. i want dashboard to look like this
Attribute Metric
A 1
B 2
C 3
X 4
Y 5
Z 6
When i create my result look like below.
Attribute1 Attribute2 Metric
A X 1
B y 2
C z 3
Please help.
Can you reformat your results - Attribute Metric A 1 B 2 C 3 X 4 Y 5 Z 6
I think you mean you want to view metrics for the elements for both the attributes appended one below the other.
I'd suggest you create a consolidation / custom group object and add all elements from both your attributes.
And use this consolidation / custom group instead of the attribute on your report.

Aggregating from multiple columns in Tableau

I have a table that looks like:
id aff1 aff2 aff3 value
1 a x b 5
2 b c x 4
3 a b g 1
I would like to aggregate the aff columns to calculate the sum of "value" for each aff. For example, the above gives:
aff sum
a 6
b 10
c 4
g 1
x 9
Ideally, I'd like to do this directly in tableau without remaking the table by unfolding it along all the aff columns.
You can use Tableau’s inbuilt pivot method as below, without reshaping in source .
CTRL Select all 3 dimensions you want to merge , and click on pivot .
You will get your new reshaped data as below, delete other columns :
Finally build your view.
I hope this answers . Rest other options for the above results include JOIN at DB level, or creating multiple calculated fields for each attribute value which are not scalable.

Cumulative min on earlier versions of PostgreSQL

I am using PostgreSQL 8.2, which is main reason why I'm asking this question. I want to get in this version of PostgreSQL a column (let name it C) with cumulative minimum for some other preordered column (let name it B). So on n-th row of column C should be minimum of values of B in rows 1 to n for some ordering.
In example below column A gives order and column C contains cumulative minimum for column B in that order:
A B C
------------
1 5 5
2 4 4
3 6 4
4 5 4
5 3 3
6 1 1
Probably easiest way to explain what I want is what, in later versions, next query does:
SELECT A , B, min (B) OVER(ORDER BY A) C FROM T;
But version 8.2, of course, don't have window functions.
I've written some plpgsql functions that do this on arrays. But to use this I have to use array_agg aggregate function that I again wrote myself (there no built in array_agg in that version). This approach isn't very efficient and while it worked well on smaller tables it becoming almost unusable now that I need to use it on bigger ones.
So I would be very grateful for any suggestions of alternative, more efficient solutions of this problem.
Thank you!
Well, you can use this simple subselect:
SELECT a, b, (SELECT min(b) FROM t t1 WHERE t1.a <= t.a) AS c
FROM t
ORDER BY a;
But I doubt it will be faster for big tables than a plpgsql function. Maybe you can show us your function. There might be room for improvement there.
For this to be fast you should have a multi-column index like:
CREATE INDEX t_a_b_idx ON t (a,b);
But really, you should upgrade your to a more recent version of PostgreSQL. Version 8.2 has reached end of life last year. No more security updates. And so many missing features ...

JasperReports Crosstab Query

I'm using JasperReports \ iReport crosstabs to create a matrix of student and results.
So for example Jim is doing subjects A, B, C and Sally is doing A, C
What I want is something like:
Subj-A Subj-B Subj-C
Jim P M D
Sally D D
But as my SQL orders by name then subject I get:
Subj-A Subj-B Subj-C Subj-A Subj-C
Jim P M D
Sally D D
As you can see in the above the results are correct but the formatting is woeful.
Is there anyway I can generate the reports to use names and subject only once
and filling in the values from here?
To follow-up on this.
JasperReports is primarily used to represent the data so the work here needs to be done here via the SQL.
In a case where there is a crosstab of X vs Y we may need to use a cross-join which bacically compute all the combination of X subject and Y students.
After the cross-join we can use an outer-join on the candidate details to find there results. After this it is a basic matter of representation in Jasper.