Show the same field twice, side by side, with different values - crystal-reports

How can I want print the same field twice with different value for each?
My Product and Shop tables are linked with product_id as the primary/foreign key.
Product
product_id
product_name
Shop
shop_id
product_id
quantity_product
When I use Expert Selection, I take all products on Shop_id 1 and Shop_id 2 (if Shop_id is in {1,2}...). Now I want to print 2 different quantity_product fields from Shop 1 and Shop 2 in the same line as my product_id. Something like:
product_name quantity_product(shop_id: 1) quantity_product(shop_id: 2)
1 10 20
I tried adding a new link in my database scheme with another Shop table, but it didn't work out.

You can set up a CrossTab in the summary section to handle any number of Shops. (So long as there's room on the report for all the shop columns)
If that doesn't work you can manually set up a summary for each Shop:
Keep in mind both of these solutions will need to be placed in a Footer section instead of the Details.

Related

Is there a better way to design an E-commerce products database when the products can have multiple price lines?

I'm trying to develop a new products database for a client and I am having a hard time finding a solution to handle the many different prices a product can have.
Variables that can affect the price of a product:
region (where the customer lives).
customer type (whether they're a new customer or a registered customer).
order type (whether you want to purchase the item once or subscribe monthly).
store type (there were many store types, but now they're transitioning to one, but I don't know if they will add more in the future again so I want this to be flexible
Product Table
id
product_name
sku
description
1
Vanilla Protein Powder
1111
This is a description...
Attributes Table
id
associate_type
region
store
currency_code
order_type
1
2
1
11
usd
1
2
2
1
11
usd
2
Product Attributes Table
id
price
product_id
attribute_id
1
49.95
1
1
2
29.95
1
2
I was initially thinking this would be a good route to go, but the issue that arises is on the product page I want to display the price of the product if you want to purchase it once and the price if you wanted to subscribe. The same issue would happen if I also wanted to show a list of product cards on a product category page displaying both prices.
The issue I run into
When I write a query to get the correct products with the correct price lines, I would filter all the products by the variables mentioned above, but I will always want the subscription price and the one-time price, so in the query, I would have to include WHERE order_type = 1 AND order_type = 2 but doing this would return duplicate records of the product/ products because of the different prices for a one-time purchase and a subscription purchase.
Is there a better way to set up the tables I have so that the query would not return duplicate records of the product/ products? Or is there a way to write the query to handle this for me? Or do I even need to switch up my database design altogether?

Crystal Report number of pages according to field value

My first question, so please excuse any mistakes.
We have internal ID numbers for product that we are selling, composed of: [SalesOrder_Num]/[Num].
For each Id No. we offer a Test Certificate to the client. Test Certificate defines the suitable age of product, along with its technical specification. Multiple items (20-30) on sales order can have same technical specification, but different ID number. ID Number also becomes Certificate Number.
We need to print/pdf these test certificates using Crystal Reports. There is a custom made Certificate Window on which technical specs are manually typed, along with sales order number. We also fill in number of Certificates (= [Num]).
What we now want is: Print [Num] of records/PDF with Certificate Number incrementally increasing on each PDF - [SalesOrder_Num]/1, [SalesOrder_Num]/2, ... ... ,[SalesOrder_Num]/[Num-1], [SalesOrder_Num]/[Num].
How is it possible?
Best Regards,
K
Create a REPEATER table with a single column (How_Many) that looks like this:
How_Many
1
2
3
4
5
6
etc..
Now, in your report, add the Repeater Table and add a join condition of:
Order.quantity >= Repeater.How_Many
If the ">=" join option is not available, remove the join to the REPEATER table and create this condition in the Record Selection condition:
{Order.quantity} >= {Repeater.How_Many}
This would cause each order to be duplicated as many times as the value of {Order.quantity}.
If you are restricted to using an equal join, you can also modify the repeater table to include N records for each quantity N:
1
2
2
3
3
3
...
This would cause each order to be duplicated as many times as the value of {Order.quantity}.
If you need to print "N of M" modify the repeater table to look like this:
N M
1 1
2 1
2 2
3 1
3 2
3 3
and use an equal join to the N column.
An alternative solution is to use a 3rd-party Crystal tool. At least one of the 3rd-party Crystal Reports viewers listed here provides the functionality you are seeking (without needing to add a Repeater table to your database).

SiteCatalyst transactionID Data Source Order submission

we are struggling upon make imported orders unique, through a transactionID Data Source template.
In fact, this template does not consider a "purchaseID" column, and it does not parse this variable if we force it into the template.
At the moment, we set one row for every product purchased by the same "transactionID customer", with the addictional fields below:
Date Evar 22 Category Product Orders Quantity transactionID
06/06/2015 evar_value category product_name 1 1 123456
06/06/2015 evar_value category2 product_name2 1 2 123456
... ... ... ... .. .. ... ... ... ... ... ... ... ... ... ...
This example will produce 2 Orders for the "123456" customer, even if it's the same one including 3 Units (Quantity) of 2 products.
So we expected just 1 Order for this customer.
We supposed the transactionID could be a unique key, working as the purchaseID, but it does not.
Then we tried to put all the products in the same row, removing the Category column and exploiting the "s.products" format, as below:
06/06/2015 evar_value category;product_name,category2;product_name2 1 2 123456
Now the Quantity field gets 2 units.
With this template we were closer to the goal, because the Order was correctly recognized as unique.
The issue here concerns the Products, because Data Source always seems to expect an addictional one as the first.
In this example, beside "product_name" and "product_name2" an "Unspecified" product will be reported.
To sum up: how Orders could be recognized as unique when imported through transactionID, but irrespective of template (default or custom)?
You have to use full processing data sources in this case as it will bind order to visitor.
Workaround
If you want to use this template then in first column pass 1 against order and against other pass 0 each.
Hope this helps!

Showing 4 records in a portal from same table

I have a table that contains students' results. These results are generally broken into four types: term1, term2, term3 and term4. So over a year, a student may have up to four records in that table containing his results.
I want to create a layout that contain a portal that will show all the 4 records in a single portal row. Is there any way to do this? Or any workaround?
The reason why I do not want to display the records as four rows in the portal is because there are different subjects and will not be right if each subject occupy four rows and there are many subjects a student may take.
I can think of two ways to approach this, both of which would require a relationship from your Results table occurrence to another table occurrence based on Results, let's call it Results~SameStudentID. (The matching field would the foreign key to the Student table, FK_StudentID = FK_StudentID.)
Create 4 calculation fields in your Results table: Result_1, Result_2, Result_n, etc. The formula to use for each of the calculation (starting from the context of the Results table occurrence) would be:
GetNthRecord ( Results~SameStudentID::Result ; n )
Then, simply include the 4 "Result_n" fields in your portal
Create just one field, Results_1_4, with the following formula:
Substitute ( List ( Results~SameStudentID::Result ) ; ΒΆ ; " " )

SSRS - Is it possible to have detail rows under a parent row

I have a report that currently lists data of a parent and its the details on the same row. So lets say the columns of the parent group take up the first three columns and the details the next three. Currently the first three columns span the height of the combined details rows. So if there are three detail rows the first three columns are one row that spans the height of these three columns. This is how I initially wanted it.
Now what I would like to do is list the first row of the parent group, then under that list the details, then the next row of the parent group and under that its details and so on.
An example just in case i'm not clear
CategoryId and Category Name are the parent columns
ProductId ProductName and Price are the details, and these are linked to the category by a categoryId
I want to display the first category row, then under that each product in this category, then the next category row and under it the products, then the next category etc.
Is this possible?
Thanks,
Neil
What you are looking for is called a stepped report. Here is a good guide on how to create one in SSRS 2008: How to: Create a Stepped Report.
From the webpage:
A stepped report shows detail rows or child groups indented under a
parent group in the same column, as shown in the example below:
I believe you are asking for:
Category 1 | Category A
Product A01 | $1
Product A02 | $2
Category 2 | Category B
Product B01 | $1
Product B02 | $2
You could try placing the matrix/table in a list which is grouped by category
List grouped by category id[
Table header row [ category id | category name ]
Table detail row [ productname | product price ]
]
Hope that makes sense. I predominately use SSRS2005 where there are many shortcomings like this (I put tables in lists and header tables in table cells etc etc). SSRS2008 could have another solution.
I opted for a solution using sub-reports. So I display the first three columns on the first row, then on the next (repeating) row I have a sub report which takes the categoryId and displays the products based on the ID passed into it. Works as I want it to