on 2013 Apr 18 8:09 AM
Hi All,
I have a field called brand category.I applied group on this and the order is original order ,but with that original order as in database i need some specified order
Ex:
brand_code | category | Brand_Category |
G- | HOME | Debenhams-HOME |
G- | MENS ACCESSORIES | Debenhams-MENS ACCESSORIES |
G- | HOME CONCESSIONS | Debenhams-HOME CONCESSIONS |
G- | MENS WEAR | Debenhams-MENS WEAR |
G- | KIDS WEAR | Debenhams-KIDS WEAR |
G- | OTHERS | Debenhams-OTHERS |
G- | LADIES ACC OB | Debenhams-LADIES ACC OB |
G- | OWN BOUGHT | Debenhams-OWN BOUGHT |
G- | LADIESWEAR OB | Debenhams-LADIESWEAR OB |
G- | WOMENS WEAR | Debenhams-WOMENS WEAR |
G- | ACCESSORIES | Debenhams-ACCESSORIES |
G- | LINGERIE | Debenhams-LINGERIE |
LF | OTHERS | FOOT LOCKER-OTHERS |
OC | OTHERS | Coast-OTHERS |
SV | OTHERS | Victoria's Secret-OTHERS |
TW | ACCESSORIES | Brand Warehouse-ACCESSORIES |
TW | CLOTHING | Brand Warehouse-CLOTHING |
TW | OTHERS | Brand Warehouse-OTHERS |
Z0 | CARTIER | Debenhams Cosmetics-CARTIER |
Z0 | RIMMEL | Debenhams Cosmetics-RIMMEL |
Z0 | CLINIQUE | Debenhams Cosmetics-CLINIQUE |
Z0 | VERSACE | Debenhams Cosmetics-VERSACE |
Z0 | GIORGIO ARMANI | Debenhams Cosmetics-GIORGIO ARMANI |
Z0 | JUICY COUTURE | Debenhams Cosmetics-JUICY COUTURE |
Z0 | LOREAL | Debenhams Cosmetics-LOREAL |
Z0 | BOGART | Debenhams Cosmetics-BOGART |
Z0 | NARCISO RODRIGUEZ | Debenhams Cosmetics-NARCISO RODRIGUEZ |
Z0 | CHANEL | Debenhams Cosmetics-CHANEL |
Z0 | SHISEIDO | Debenhams Cosmetics-SHISEIDO |
Z0 | DAVIDOFF | Debenhams Cosmetics-DAVIDOFF |
Z0 | YOHJI | Debenhams Cosmetics-YOHJI |
Z0 | GIVENCHY | Debenhams Cosmetics-GIVENCHY |
Z0 | KANEBO | Debenhams Cosmetics-KANEBO |
Z0 | MAKE UP FOR EVER | Debenhams Cosmetics-MAKE UP FOR EVER |
Z0 | BOURJOIS | Debenhams Cosmetics-BOURJOIS |
Z0 | OTHERS | Debenhams Cosmetics-OTHERS |
Z0 | CHLOE | Debenhams Cosmetics-CHLOE |
Z0 | ST. DUPONT | Debenhams Cosmetics-ST. DUPONT |
Z0 | DOLCE & GABBANA | Debenhams Cosmetics-DOLCE & GABBANA |
Z0 | YSL | Debenhams Cosmetics-YSL |
Z0 | GUCCI | Debenhams Cosmetics-GUCCI |
Z0 | LA PRAIRIE | Debenhams Cosmetics-LA PRAIRIE |
Z0 | MAX FACTOR | Debenhams Cosmetics-MAX FACTOR |
Z0 | BURBERRY | Debenhams Cosmetics-BURBERRY |
Z0 | PACO RABANNE | Debenhams Cosmetics-PACO RABANNE |
Z0 | CHOPARD | Debenhams Cosmetics-CHOPARD |
Z0 | THIERRY MUGLER | Debenhams Cosmetics-THIERRY MUGLER |
Z0 | DUNHILL | Debenhams Cosmetics-DUNHILL |
Z0 | GUERLAIN | Debenhams Cosmetics-GUERLAIN |
Z0 | LALIQUE | Debenhams Cosmetics-LALIQUE |
Z0 | MAYBELLINE | Debenhams Cosmetics-MAYBELLINE |
Z0 | BVLGARI | Debenhams Cosmetics-BVLGARI |
Z0 | PUPA | Debenhams Cosmetics-PUPA |
Z0 | CHRISTIAN DIOR | Debenhams Cosmetics-CHRISTIAN DIOR |
Z0 | U MUJER | Debenhams Cosmetics-U MUJER |
Z0 | ESCADA | Debenhams Cosmetics-ESCADA |
Z0 | HELENA RUBINSTEIN | Debenhams Cosmetics-HELENA RUBINSTEIN |
Z0 | LANCOME | Debenhams Cosmetics-LANCOME |
Z0 | MICALLEF | Debenhams Cosmetics-MICALLEF |
Z0 | CAROLINA HERRERA | Debenhams Cosmetics-CAROLINA HERRERA |
Z0 | RALPH LAUREN | Debenhams Cosmetics-RALPH LAUREN |
Z0 | CLARINS | Debenhams Cosmetics-CLARINS |
Z0 | VAN CLEEF & ARPELS | Debenhams Cosmetics-VAN CLEEF & ARPELS |
Z0 | ESCENTRIC MOLECULES | Debenhams Cosmetics-ESCENTRIC MOLECULES |
Z0 | HERMES | Debenhams Cosmetics-HERMES |
Z0 | LOEWE | Debenhams Cosmetics-LOEWE |
Z0 | BOBBI BROWN | Debenhams Cosmetics-BOBBI BROWN |
Z0 | MORRIS | Debenhams Cosmetics-MORRIS |
i need like this
Debenhams-ACCESSORIES
Debenhams-LINGERIE
Debenhams-HOME
and then same order as in database
.................
Debenhams Cosmetics-JUICY COUTURE
Debenhams Cosmetics-LOEWE
Debenhams Cosmetics-BOGART
............
and then same as in database
Hi Francis,
Both Prathamesh and Samuel have suggested the right approaches. Here is another way to do this:
1) Create two array variables. Each array variable will hold custom values. In this case, the formula can look like this:
stringvar array grp1 := ["Debenhams-ACCESSORIES","Debenhams-LINGERIE","Debenhams-HOME"];
stringvar array grp2 := ["Debenhams Cosmetics-JUICY COUTURE", "Debenhams Cosmetics-LOEWE", "Debenhams Cosmetics-BOGART"];
""
So, array variable grp1 will hold names in the order that you wish to be shown at the beginning. Similarly array variable grp2 contains values in the order that you want them to appear towards the end.
2) Create a formula that will put the Brand Names in separate groups:
if {Brand_Category} in ["Debenhams-ACCESSORIES","Debenhams-LINGERIE","Debenhams-HOME"] then
"A"
else if {Brand_Category} in ["Debenhams Cosmetics-JUICY COUTURE", "Debenhams Cosmetics-LOEWE", "Debenhams Cosmetics-BOGART"] then
"C"
else
"B"
3) Insert a group on the above formula from the Group Expert. You should see three Groups - A, B and C on the report
4) Insert a 2nd group on the Brand Category field. While in the same window,select the 2nd group and click the Options button > Choose "Original Order" as the Sort Order
5) The report now shows Brand Categories lined up as per the database order. This also re-organizes the records under Group A and C in the database order, however you want these records to be shown in the same order as it appears in the array variable, right?
6) Create another formula that displays the values in the array and place this on the Group Header 2:
WhilePrintingRecords;
stringvar array grp1;
stringvar array grp2;
numbervar x;
if GroupName ({@Name_of_the_formula_created_in_step2}) = "A" then
(
x := x + 1;
grp1[x];
)
else if GroupName ({@Name_of_the_formula_created_in_step2}) = "C" then
(
x := x + 1;
grp2[x];
)
else
{Brand_Category}
7) One last formula to reset a variable. Place this formula on the Group Header 1:
WhilePrintingRecords;
numbervar x := 0;
😎 You can then go ahead and delete the "Group #2 Name" text object from Group Header 2 and just have the display formula created in Step 6 show the Group Name. You will also need to Suppress Group Header 1, Group Footer 1 and Group Footer 2
This will now show up as a combination of both Specified Order and Original Order grouping.
Let me know how this goes.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
Can you please clarify above error.
And now my report connected to one database,but we have another database having diff brand categories there also we have to display the specified order.
In live there are different databases.Then for every database they have some brand categories.Suppose they have 10 different databases then how we can apply this specified order for all those values.If tomorrow another new database came what we have to do.Please suggest.
Thanks,
Francis
Remove this formula from the report. Do you see the three groups A, B and C?
Also, the number of values in the Group A and the number of Brands you put in the grp1 variable in the 1st group should match.
When you create a specified order, you assign some static values to a set or names. You either make these values dynamic by finding out which names need to go in which group and then create the array.
If there are multiple databases then this might not work since "Debenhams-ACCESSORIES" might not be available in some other table. In such cases you would need to find out which values belong to let's say group A. For e.g: all values beginning with Debenhams go into this group etc.
-Abhilash
You still have the same issue with the Subreports. You will still need to separate Brand Names manually since one particular brand might not be available in a particular table on another database.
There has to be some 'method' to identify which values or what type of values will 'always' have a specified order while the rest will be in Original Order.
If we have that then we can either create a generic formula and use my approach or use the Subreport path.
I believe Francis has quite a few options here and it is he who needs to identify which values have a particular sequence. You can't expect randon values to follow an order and also expect them to work for all databases.
-Abhilash
Hi Francis,
If this is understood correctly, you need a specified order and original order grouping in combination.
In that case, it is better to segregate the required brand-categories in 2 separate sub reports OR a single main report with a sub report.
Having 2 separate sub reports is much preferable since it would be easier to handle the passing of parameter values and other calculations between the main report and the 2 sub's.
Please let the forum know if you need more information.
Thanks,
Prathamesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am unsure if subreports will help or just complicate the problem.
For me, it is all about how you wish to display the data once the new grouping is made.
Using a formula such as the one below can acheive the order you want but you may need to insert another group of the original brand category.
To avoid this, and to give you a top level group per brand category, you can concatenate the original 'useful' brand name to the numbers (using '001' + {Sheet1_.Brand_Category} instead of just '001' for example). This gives you a better first level grouping for a helpful group tree.
Using the formula below, and grouping on this instead of brand category as you currently are, will mean you need to work out where the non-Debenhams or Debenhams Cosmetics entries go.
Let me know if you need any more info on this.
IF
{Sheet1_.Brand_Category} = 'Debenhams-ACCESSORIES'
THEN
'001'
ELSE
IF
{Sheet1_.Brand_Category} = 'Debenhams-LINGERIE'
THEN
'002'
ELSE
IF
{Sheet1_.Brand_Category} = 'Debenhams-HOME'
THEN
'003'
ELSE
IF
{Sheet1_.Brand_Category} startswith 'Debenhams-'
THEN
'004'
ELSE
IF
{Sheet1_.Brand_Category} = 'Debenhams Cosmetics-JUICY COUTURE'
THEN
'005'
ELSE
IF
{Sheet1_.Brand_Category} = 'Debenhams Cosmetics-LOEWE'
THEN
'006'
ELSE
IF
{Sheet1_.Brand_Category} = 'Debenhams Cosmetics-BOGART'
THEN
'007'
ELSE
IF
{Sheet1_.Brand_Category} startswith 'Debenhams Cosmetics-'
THEN
'008'
ELSE
'!ZZZ'
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.