How to display same table multiple times with Crystal Reports? - crystal-reports

I have two tables on a report. Across the two tables, I need 8 total columns. The tables have the same data; only the columns shown are different. I need the first table drawn first, and then the next table after that on a new page.
Here's the report structure I would like...
Page 1:
Properties Table
Id | Name | etc...
--------------------
1 | Bob | ...
2 | Matt | ...
3 | John | ...
...
After Properties table, on a new page:
Relationships Table
Id | Relationships | etc...
-----------------------------
1 | Matt | ...
2 | Bob | ...
3 | (NULL) | ...
...
Assuming the data source is the same for both tables (it returns all 8 columns I need), how can I achieve this on the report?
I believe the idea is to use subreports, but I can't find a mechanism to pass in the data from the main report.

Related

What is the column limit for Spark Data Frames?

Our team is having a lot of issues with the Spark API particularly with large schema tables. We currently have a program written in Scala that utilizes the Apache spark API to create two Hive tables from raw files. We have one particularly very large raw data file that is giving us issues that contains around ~4700 columns and ~200,000 rows.
Every week we get a new file that shows the updates, inserts and deletes that happened in the last week. Our program will create two tables – a master table and a history table. The master table will be the most up to date version of this table while the history table shows all changes inserts and updates that happened to this table and showing what changed. For example, if we have the following schema where A and B are the primary keys:
Week 1 Week 2
|-----|-----|-----| |-----|-----|-----|
| A | B | C | | A | B | C |
|-----|-----|-----| |-----|-----|-----|
| 1 | 2 | 3 | | 1 | 2 | 4 |
|-----|-----|-----| |-----|-----|-----|
Then the master table will now be
|-----|-----|-----|
| A | B | C |
|-----|-----|-----|
| 1 | 2 | 4 |
|-----|-----|-----|
And The history table will be
|-----|-----|-------------------|----------------|-------------|-------------|
| A | B | changed_column | change_type | old_value | new_value |
|-----|-----|-------------------|----------------|-------------|-------------|
| 1 | 2 | C | Update | 3 | 4 |
|-----|-----|-------------------|----------------|-------------|-------------|
This process is working flawlessly for shorter schema tables. We have a table that has 300 columns but over 100,000,000 rows and this code still runs as expected. The process above for the larger schema table runs for around 15 hours, and then crashes with the following error:
Exception in thread "main" java.lang.StackOverflowError
at scala.collection.generic.Growable$class.loop$1(Growable.scala:52)
at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:57)
at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:183)
at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.immutable.List.flatMap(List.scala:344)
Here is a code example that takes around 4 hours to run for this larger table, but runs in 20 seconds for other tables:
var dataframe_result = dataframe1.join(broadcast(dataframe2), Seq(listOfUniqueIds:_*)).repartition(100).cache()
We have tried all of the following with no success:
Using hash broad-cast joins (dataframe2 is smaller, dataframe1 is huge)
Repartioining on different numbers, as well as not repartitioning at all
Caching the result of the dataframe (we originally did not do this).
What is causing this error and how can we fix it? The only difference between this problem table is that it has so many columns. Is there an upper limit to how many columns Spark can handle?
Note: We are running this code on a very large MAPR cluster and we tried giving the code 500GB of RAM and its still failing.

Is it possible to use different forms and create one row of information in a table?

I have been searching for a way to combine two or more rows of one table in a database into one row.
I am currently creating multiple web-based forms that connect to one table in my database. Is there any way to write some mysql and php code that will take separate form submissions and put them into one row of the database instead of multiple rows?
Here is an example of what is going into the database:
This is all in one table with three rows.
Form_ID represents the three different forms that I used to insert the data into the table.
Form_ID | Lot_ID| F_Name | L_Name | Date | Age
------------------------------------------------------------
1 | 1 | John | Evans | *NULL* | *NULL*
-------------------------------------------------------------
2 |*NULL* | *NULL* | *NULL* | 2017-07-06 | *NULL*
-------------------------------------------------------------
3 |*NULL* | *NULL* | *NULL* | *NULL* | 22
This is an example of three separate forms going into one table. Every time the submit button is hit the data just inserts down to the next row of information.
I need some sort of join or update once the submit button is hit to replace the preceding NULL values.
Here is what I want to do after the submit button is hit:
I want it to be combined all into one row but still in one table
Form_ID is still the three separate forms but only in one row now.
Form_ID |Lot_ID | F_Name | L_Name | Date | Age
----------------------------------------------------------
1 | 1 | John | Evans | 2017-07-06 | 22
My goal is once a one form has been submitted I want the next, different form submission to replace the NULL values in the row above it and so on to create a single row of information.
I found a way to solve this issue. I used UPDATE tablename SET columname = newColumnName WHERE Form_ID = newID
So this way when I want to update rows that have blanks spaces I have it finding the matching ID's

How to merge table cells when adjacent cell empty?

I'm looking for a way to merge cells, but only when a condition is true. Other suggestions to my problem are fine, too.
Background: I need to create a Jasper report for which I got a design/layout specification. All data is provided through a single stored procedure.
The layout is mostly a simple table with data, but some rows differ from the rest and contain some sort of interim report data (that's not calculated from the previous values). Those rows also differ in the row layout. Number of rows before and after are dynamic.
Example:
------------------------------------
| data | data | data | data | data |
------------------------------------
| data | data | data | data | data |
------------------------------------
| data | data | data | data | data |
------------------------------------
| some text | abc | def |
------------------------------------
| data | data | data | data | data |
------------------------------------
| different text | xyz |
------------------------------------
The procedure delivers all of this data in a single data set, including the text of those special rows. For those cell that should be merge with their left adjacent cell the procedure returns NULL, all other cells always contain some sort of data.
Now I could need some help to actually merge those cells. If there are other/better ways to achieve the given layout, feel free to suggest those.
Unfortunately I have no control over the stored procedure, but slight alterations might be possible.

Is it possible to get 3 select query results by executing only one stored procedure?

I have to display data in the following format
-----------------------------------------------------------
| Group Name | Description | Assigned Users | Super Groups|
-----------------------------------------------------------
|Group1 | Blah Blah | User1 | SPG1 |
| | | User2 | SPG3 |
| | | User3 | |
-----------------------------------------------------------
| Group2 | More Blah | User1 | SPG5 |
| | | User13 | |
-----------------------------------------------------------
Assigned users and Super groups data are coming from unrelated tables. Now I wonder whether is it possible to get 3 select query results in one shot (i.e. the same procedures returns 3 results). Otherwise I'm going to query the groups and users first, get the group IDs then query super groups.
So again, Is it possible to get 3 select query results by executing only one stored procedure?
Yes, just include 3 select statements.
If you're consuming these in .net and storing them in a DataSet you'll have 3 tables in the DataSet.
Example:
create procedure test
as
select 1 as res1;
select 2 as res2;
select 3 as res3
exec test
Yes. You'll have to include the three statements in your stored procedure. Take a look at this post.

Derived Associations with Entity Framework

I've just started with Entity Framework this week, and am struggling with a few of the concepts.
Right now, I have a database structure that I am struggling to transfer across to entity framework.
I have started with the model first, and have this:
------------------ -----------------------
| Order_Item | | Order_FetchableItem |
---------------- ---------------------
| order_id | | order_id |
| item_id | | item_id |
------------------ | fetch_url |
-----------------------
The idea is that orders contain items, and this relation is conveyed in the order_item table. HOWEVER, some (not all) of the items in an order have a URL, so this property needs to be stored too.
I can't get this working in EF, because EF detects Order_Item as a relation, and I can't derive from it. What's the best alternative for doing this?
I have considered moving the fetch_url field to the Order_Item table, but as it is a wide column, I don't want lots of NULL values in the order_item table.
Thanks, and please excuse the formatting above!