Mercurial: Merge a single change into an unnamed branch - mercurial

I have a project that sometimes branches out for a time. I don't use named branches.
I then use Merge in order to pull the branch back together. So given a tree like this
o Change 3 on Branch B
║
o Change 2 on Branch B
║
║ o Change 1 on Branch A
╠═╝
o Source
I can merge in Change 2 like this
o Merge of change 2 into Branch A
╠═╗
║ ║ o Change 3 on Branch B
║ ╠═╝
║ o Change 2 on Branch B
║ ║
o ║ Change 1 on Branch A
╠═╝
o Source
But what would be the recommended way to copy/merge Change 3 into Branch A, without merging its parents? (specifically, without merging Change 2)
The way I do it now is to manually compare the difference between 2 and 3, and repeat the changes in a number 4.

Because you already merged Change 2 on Branch B and Change 3 on Branch B is single unmerged cset in branch, you can just merge branches again
In case of "merge only some unmerged changeset from branch to branch" you have to use graft, as mentioned (in fresh Mercurial) or transplant

Related

How to perform a many-to-many or (at least) a outer-join in SPSS

usually I use [R] for my data analysis, but these days I have to use SPSS. I was expecting that data manipulation might get a little bit more difficult this way, but after my first day I kind of surrender :D and I really would appreciate some help ...
My problem is the following:
I have two data sets, which have an ID number. Neither data sets have a unique ID (in one data set, which should have unique IDs, there is kind of a duplicated row)
In a perfect world I would like to keep this duplicated row and simply perform a many-to-many-join. But I accepted, that I might have to delete this "bad" row (in dataset A) and perform a 1:many-join (join dataset B to dataset A, which contains the unique IDs).
If I run the join (and accept that it seems not to be possible to run a 1:many, but only a many:1-join), I have the problem, that I lose IDs. If I join dataset A to dataset B I lose all cases, that are not part of dataset B. But I really would like to have both IDs like in a full join or something.
Do you know if there is (kind of) a simple solution to my problem?
Example:
dataset A:
ID
VAL1
1
A
1
B
2
D
3
K
4
A
dataset B:
ID
VAL2
1
g
2
k
4
a
5
c
5
d
5
a
2
x
expected result (best solution):
ID
VAL1
VAL2
1
A
g
1
B
g
2
D
k
3
K
NA
4
A
a
2
D
x
expected result (second best solution):
ID
VAL1
VAL2
1
A
g
2
D
k
3
K
NA
4
A
a
5
NA
c
5
NA
d
5
NA
a
2
D
x
what I get (worst solution):
ID
VAL1
VAL2
1
A
g
2
D
k
4
A
a
5
NA
c
5
NA
d
5
NA
a
2
D
x
From your example It looks like what you need is a full many to many join, based on the ID's existing in dataset A. You can get this by creating a full Cartesian-Product of the two dataset, using dataset A as the first\left dataset.
The following syntax assumes you have the STATS CARTPROD extention command installed. If you don't you can see here about installing it.
First I'll recreate your example to demonstrate on:
dataset close all.
data list list/id1 vl1 (2F3) .
begin data
1 232
1 433
2 456
3 246
4 468
end data.
dataset name aaa.
data list list/id2 vl2 (2F3) .
begin data
1 111
2 222
4 333
5 444
5 555
5 666
2 777
3 888
end data.
dataset name bbb.
Now the actual work is fairly simple:
DATASET ACTIVATE aaa.
STATS CARTPROD VAR1=id1 vl1 INPUT2=bbb VAR2=id2 vl2
/SAVE OUTFILE="C:\somepath\yourcartesianproduct.sav".
* The new dataset now contains all possible combinations of rows in the two datasets.
* we will select only the relevant combinations, where the two ID's match.
select if id1=id2.
exe.

How to divert to report with expression in SSRS

Hi I have a SSRS Report in which i get a table report.
╔══════════════╦════════════════╦════════════════╗
║ Company Name ║ Customer Count ║ Employee Count ║
╠══════════════╬════════════════╬════════════════╣
║ Company A ║ 1000 ║ 50 ║
╠══════════════╬════════════════╬════════════════╣
║ Company B ║ 2000 ║ 100 ║
╠══════════════╬════════════════╬════════════════╣
║ Company C ║ 3000 ║ 150 ║
╚══════════════╩════════════════╩════════════════╝
I want to go to report by Company Name.
Suppose if User click on Company A Then it should go to Report CompanyAReport.
If i click on Company B it should redirect to CompanyBReport.
To Achieve this scenario you have to create a separate report which will load details of the company.
So another report which might be drill down report of the company which gives list all Employees or customers of the company.
And you have to put the link on your report to redirect to another report with the parameters like.
In your report there will be tablix in which you will display all companies data. In that tablix textbox for CompanyName you have to open the property window like in below image.
in above image for textbox property there will be Action tab in that you can set action (href) where you want to redirect when user clicks on company name. You can also set the parameters of the report that you need to pass to open that report.
Assuming the company report will be the same for both Company A and Company B then..
Create a new report ()called say, _subCompanyReport) that takes a parameter CompanyName.
Build a dataset that gets the info you need e.g. SELECT * FROM myCompanyTable WHERE CompanyName = #CompanyName
Add whatever you need to show on that report.
Go back to your original report, right-click the company name cell and and choose textbox properties.
Click Action, select Go to Report, choose _subCompanyReport from the report list
Click Add to add a parameters, choose or type CompanyName (case sensitive) in the Name field and finally select the "Company name" column from your report in the Value field.
That's pretty much it. If you have problems, makes sure all parameter names are spelled correctly, they are case sensitive.

Birt report - count the number of times it matches a criteria

╔═══╦════════════╦═════════════╗
║id ║ TV# ║ Time ║
╠═══╬════════════╬═════════════╣
║ 1 ║ TV1 ║ 0 ║
║ 2 ║ TV2 ║ 10 ║
║ 3 ║ TV3 ║ 0 ║
║ 4 ║ TV3 ║ 20 ║
║ 5 ║ TV3 ║ 21 ║
║...║ ... ║ ... ║
╚═══╩════════════╩═════════════╝
I want to count the number of elements id, for each TV#, which time > 0.
In this case, I want the result to be:
TV1 - 0 ; TV2 - 1; TV3 - 2
I'm using BIRT Report, and I've tried different ways to get this, but I couldnt get what I want.
I've tried different ways, this is what I'm using at the moment:
Data Cube, Summary fields (measure)
Function: Count
Expression: measure["id"]
Filter: measure["Time"]>0
And then I'm using an Aggregation Builder:
Function:Count or Sum
Expression:measure["id"]
Filter: measure["Time"]>0
Aggregate on: GroupTV#
When I use count, this is returning: only 0s and 1s (it gives me "1" to TV# when there is at least one Time>0), ie TV1 - 0 ; TV2 - 1; TV3 - 1
When I use sum, this is returning: the number of times each TV# appears on the table (when there is at least one Time>0 for that channel), ie TV1 - no output ; TV2 - 1; TV3 - 3
Can someone help me?
E.g.:
SELECT tv
, SUM(CASE WHEN time > 0 THEN 1 ELSE 0 END) x
FROM my_table
GROUP
BY tv;
Either method should work, however in your example you're counting the occurrences of a particular id instead of 'TV#'.
Naturally as the id's are unique there will only ever be a maximum of one occurrence of each.
You need:
Function: Count
Expression: change from 'id' to 'TV#'
Filter: measure["Time"] > 0
Instead of using filters on Data Cube, or on Cross Tabs or on Charts, just filter on Data Sets.

SSRS Conditional Text Color Based On Other Group's Value

To simplify my need: I am comparing a projected sales number to the budgeted sales number and need to color the Projected amounts as red, black, or green, based on whether they are less, equal, or greater than the corresponding Plan amounts. Essentially my data boils down to
║ Group ║ Amount ║ Type ║
╠═══════╬════════╬═══════════╣
║ 1 ║ .95 ║ Projected ║
║ 2 ║ 0 ║ Projected ║
║ 3 ║ .04 ║ Projected ║
║ 1 ║ 1.3 ║ Plan ║
║ 2 ║ 0 ║ Plan ║
║ 3 ║ .03 ║ Plan ║
My tablix is using a column grouping based on the Type.
I tried the following Expression, but it's giving me Green when it should be Red.
=iif(SUM(Fields!Amount.Value)<SUM(iif(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"),"Red",iif(SUM(Fields!Amount.Value)>SUM(iif(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"),"Green","Black"))
My desired output is the following:
I think it would be easier if you change your query to retrieve the data in a different way. However I'll expose a SSRS and a T-SQL solution:
SSRS Solution:
Add a calculated field to your dataset and concatenate the Group and Type.
=Fields!GroupID.Value & "-" & Fields!AmountType.Value
I am using the data you put in your question in order to recreate your scenario. Supposing you are using a matrix to get the desired output just use this data arrangement:
Now in Amount cell font color property use the following expression:
=IIF(
Fields!AmountType.Value="Projected",
IIF(
Fields!Amount.Value >
Lookup(Fields!Group.Value & "-" & "Plan",Fields!GroupType.Value,Fields!Amount.Value,"DataSet3"),
"Green",
IIF(
Fields!Amount.Value <
Lookup(Fields!Group.Value & "-" & "Plan",Fields!GroupType.Value,Fields!Amount.Value,"DataSet3"),
"Red","Black"
)
),"Black"
)
You have to change Fields!GroupType.Value according to the name you set for the calculated field.
It will preview the following matrix:
This solution will only work if you compare only two different types:
Projected and Plan
T-SQL Solution (recommended):
Change your dataset query to get the data in a proper way to compare it. Based on the table you posted I've used this query.
SELECT
a.GroupID,
a.Amount [Projected],
pl.Amount [Plan]
FROM your_table a
INNER JOIN (SELECT
*
FROM your_table
WHERE AmountType = 'Plan') pl
ON a.GroupID = pl.GroupID
WHERE a.AmountType = 'Projected'
It produces:
Try yourself by this fiddle:
With the T-SQL solution the comparation between plan amount and projected amount is trivial in SSRS.
Let me know if this helps you.
I think your issue is that you are comparing the total of Projected + Plan with Projected so it would always be greater.
=IIF(SUM(IIF(Fields!Type.Value = "Projected", Fields!Amount.Value, 0)) < SUM(IIF(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"), "Red",
IIF(SUM(IIF(Fields!Type.Value = "Projected", Fields!Amount.Value, 0)) > SUM(iif(Fields!Type.Value = "Plan",Fields!Amount.Value,0),"Type"), "Green", "Black"))

MS Access - Division by zero + Nz()

I have two cross tab queries (see below for structure). Pretty simple. The first takes the total of each building type that my company owns in each city, and the second takes the total of ALL (not just company owned) buildings by type in the entire city.
All I want to do is calculate a percentage, but I am having a lot of trouble. I think I am pretty close though, but for some reason, my Nz() function isn't working properly. I keep getting the "Division by zero error." Here's my percent formula:
DCount(
"[ID]","[Company_owned]") / DCount(
"[ID]","[City_Totals]", "[Year_built]=2000" & Nz(Year_built, "null")
)
)
Here is the layout of my cross tab queries.
1)
╔═══════════════════════════════════════════════════════════════════════════════╗
║ Building type: 1 2 3 4 5 6 7 ║
╠═══════════════════════════════════════════════════════════════════════════════╣
║ City Atlanta 0 7 0 2 3 4 9 ║
║ New York 0 0 2 5 7 8 2 ║
║ San Francisco 1 1 2 3 4 5 6 ║
╚═══════════════════════════════════════════════════════════════════════════════╝
2)
╔═══════════════════════════════════════════════════════════════════════════════╗
║ Building type: 1 2 3 4 5 6 7 ║
╠═══════════════════════════════════════════════════════════════════════════════╣
║ City Atlanta 8 9 3 2 3 7 9 ║
║ New York 0 0 2 7 7 9 2 ║
║ San Francisco 3 1 9 3 5 5 8 ║
╚═══════════════════════════════════════════════════════════════════════════════╝
Can someone please tell me why I am getting the "Division by zero" error and whether or not this is a sound strategy for calculating the percentages from data in two cross tab queries (I have also considered doing all of the percentage calculations in the report, but this seems a little more tedious)
I'm guessing a bit here, but I think what you are looking for is something more like this:
DCount("[ID]","[Company_owned]") / _
DCount("[ID]","[City_Totals]", "[Year_built]" & _
IIf(IsNull(Year_built), " Is Null", "=" & Year_built))
Note: Leave off the line continuation chars (_) and just run each line together if you are doing this in a query.
I think the reason you are having trouble is because the second criteria you wrote was evaluating to something like this: [Year_built]=20002008 or this [Year_built]=2000null.
Even if leaving the 2000 in was just a typo in your question, this: [Year_built]=null would still not do what you seem to expect. You need the Is Null statement in that case.