get part of a Tree Structure in Crystal Reports - crystal-reports

I have the tree stucture of the departments of a company.
The link for the Parent-Child department in the table is:
Departments.ID->Departments.parentID.
However I don't need the whole tree.
The thing is that the structure of the departments has changed during the years and I would like to keep only a part of the tree.
For example:
-Root
--Parent 1
---Child 01
---Child 02
--Parent 2
---Child 01
---Child 02 (This is the parent that I want to have in my "shorter" tree
----Child 001 (This is the part of the tree that I want. The depth is more than 1)
---Child 04
--Parent 03
Can I say something like "get me everything under Child 001"?
Does this even makes sense?
Thanks for any advice.

I think I rushed and ask the question.
While I was adding tables and data for my report the tree gets "shorter" because of database fields that are null. So when I added all the tables that I wanted to use, the "older" departments disapear because of the NULLs.

If you are using the File System Data connection, add this to your record-selection formula:
{x.Directory}="Root\Parent 2\Child 02
OR {x.Parent Directory} LIKE "Root\Parent 2\Child 02*"
You could also choose to set the database 'table' to the desired parent node.

Related

check what data does not match on a customer list using tsql

I have a customer list table holding all data for a number of our branches. We have recently had a load of customers move from branch 02 to branch 04 but have all now got a different customer number. small example below:
table.customers
branch
cust_code
post_code
email
tel
mob
02
1234
de5 1ac
fgfg#b.com
0178
0188
04
1432
de5 1ac
fgfg#b.com
0178
0188
02
8528
st4 3ad
thng#b.com
0164
1654
04
6132
st43 ad
thng#b.com
0164
1654
02
8523
de4 1ac
fgfg#b.com
0178
0188
04
7463
de4 1ac
fggf#b.com
0178
0188
So I need to now check that all data has been moved from branch 02 to branch 04 correct, with only the cust_Code being allowed to be different on the columns stated. I do have a list of branch 02 customer codes and the new corresponding branch 04 customer codes. so can tell the query a customer code at branch 02 and to check the customer code at branch 04 to see if the rest of the columns match.
As you can see above the first customer 1234 everything is fine and matches so this can pass the check.
But the customers in bold and italics have something typed incorrect.
I am wanting to write some T-SQL query to now help me identify which customers have non matching data.
Sorry, but you should not base your query in "hope".
First, make sure you make a table with the customer codes before and after the branch move. Let's assume a table named [pairs] with two columns, [branch02code] and [branch04code]. You make sure this has the correct data from excel. Then, you use that to join one copy of customers for each branch, and maybe use a case to figure differences:
select
p.*
,stats_query.records_match
from
pairs p
inner join customers b2 on p.branch02code = b2.cust_code
inner join customers b4 on p.branch04code = b4.cust_code
cross apply
(select case
when b2.post_code = b4.post_code and b2.email= b4.email and b2.tel=b4.tel and ......
then 1
else 0
end as records_match
) as stats_query
order by stats_query.records_match desc

Power Automate - calculating azure devops data

I’m looking for some help creating a flow to calculate work item progress in Azure Devops.
When a task’s state gets updated, I want to get data from the task Parent (Feature) and find all the children (siblings) tasks. (working).
With the list of child/sibling task ID’s I want to get a total number of siblings, and the state value for each task. (working)
With the total number of child/siblings, I want to get the total possible score (working)
Then I want to split/parse the state value so it’s only the first two characters, convert the value to an integer, and get a sum of the state value. (this is where I need help)
Note: When the state value is 07 it’s considered 100% complete. For Example, if I have 5 items and everything is 07/complete the total score would be 35.
Example: 1 feature found 5 child tasks.
Example
example output from "Create HTML Table"
Example
I'd like help with an expression to take the output from the table, and Then Sum the actual score, EG 03 + 05 + 01 + 07 + 03 = (19)
then divide the actual score (19) by the total possible score (35) = .54 then *100 to get 54%
Example
Feels like there should be a simple way to do this.
Any help is greatly appreciated.
Cheers,
JG

BIRT Mathematics on data set

I am pretty new to Birt reporting, i can make simple charts and tables, bet when it comes to some calculation of values from data sets - i have no clue in which direction should i watch.
For example i have this simple data set:
count1 count2 max type lenght
616 3858 21 STEEL 20
723 4432 14 STEEL 40
854 5869 21 ALL 20
838 5225 14 ALL 40
And i would like to have Birt to calculate approximately this:
SUM(count2)/SUM(count1) WHERE type=ALL
so this
((5869+5225)/(854+838))
My question would be how could i get there. At this point i think i would need just the right direction how these kind of operations could be made.
Thanks in advance.
I presume you want to display this value somewhere on the report, like at the bottom of a table where this data is presented. If this is the case then add an aggregation data element to the footer of the table where the data is displayed. In the aggregation data element you will have the opportunity to specify an expression SUM(count2) and a filter condition [type=ALL]. You can then do the division in another data element.
If you want to simply compute the value you described you you could do it with SQL, i.e. SELECT SUM(count2)/SUM(count1) FROM myTable WHERE type='ALL'. You would have to provide the data to the report as a data source which could be in the form of an excel spreadsheet, *.csv, database connection, etc.
So there are a few ways to do this depending on what your requirements are.

Using a query within a form - Microsoft access

Hi I have a form that has a text box in the header and when the user enters the farmer Code into the text box the relevant record is displayed.
I am using the following criteria in the query within my Form Cotton12:
Like [Forms]![Cotton12].[2012]
Now I have 2 tables Table Cotton12 and Table Cotton11. They contain a database of farmers, from the year 2012 and 2011. Sometimes the data is the same sometimes it is not. For example Farmers are given farmer codes, however due to incorrect capturing of data different farmers have been given different codes throught over the years.
What I would like to do is in the same form, have the user enter in a farmer code and data from the 2012 table come up and the data from 2011 table come up so they can be compared and if that code is not in one of the tables the fields relating to that table stay blank.
For E.g. the form might look like this.
2012
Farmer Name
Acreage
Yield Estimate
2011
Farmer Name
Acreage
Yield Estimate
Your help would be much appreciated.
There are 2 potential ways to do this.
The more complex way is to create 2 sub-forms, and link them both to the main form via Farmer Code.
The easier way would be to just use a Join query to bring in both 2011 and 2012 data into the query, and then filter the exact same way you're doing it now.
However, I agree with Hans Up that the data should really all be in one table and a FarmYear field should be added to differentiate.

Access Crosstab or Form based on 2 tables with dates

There are a few answers here already that have part answered my challenge in Access but not fully.
I have 2 tables that form the basis of my database: customers and items
I have a further 2 tables; one for order quantities against customers and items (orders_a), and one for forecast quantities against customers and items (forecast_a).
forecast_a and orders_a also have a date for each customer and item combination (basically there will be 12 dates only for the 12 months of the year - 01/01/12,01/02/12,01/03/12 etc.)
Because a user will want to manually forecast quantities for a full year for each customer and each item, if there were 2 customers and 2 items, the forecast_a table would contain 48 rows. 2 items x 2 customers = 4, 4 x 12 dates = 48. The same goes for the orders_a.
I know this is a slightly unusual set up but the user requires visibility of a full year.
My main challenge based on this is as follows:
A user will want to see a form with customers in the first column, items in the second and then (like a crosstab): Jan Forecast Qty, Jan Order Qty, Feb Forecast Qty, Feb Order Qty etc.
Therefore how would I create a crosstab to pull both these tables together, and how would I go about creating a form for data entry off the back of it?
I may well be constructing my database the wrong way but the fact that the user needs a 'grid' where every entry is manual means I can't just have a form that creates a record one at a time for orders or forecasts.
Thanks in advance!
Nick
The problem you have is that this is a task that is in essence a spreadsheet task. Accordingly it may be best handled in Excel. To achieve this create an Excel object, create a blank worksheet, populate it with the data, then have a button to suck it back into the database when the user has finished.