How to hide the parent table cell/row if child is hidden or having no data - sql

I have table (t1) which is binded with some dataset. One of the row of this table is having another table (t2). so t2 is a child of t1. I want to hide row of t1 if there is no data in t2.
I tried setting the visibility expression of t2 as =CountRows() = 0. With this t2 is hidden but there is an empty space created.
I think I have to set the visibility of t1 row which is containing t2. I tried the same expression but it did not work.
Can anybody please tell me how to hide row of t1 if there is no data in t2. Or is there anyway to bind the visibility of t2 with row visibility of t1?
Atul

you can set expression in row visibility property of table (t1) like:
IIF(CountRows("Dataset1") > 0,true,false)

Related

Auto Expand Table when source change

I am using a table1 in Sheet1
I have created a second table2 in sheet2 that collects the data from table1 (not mirror).
I cant make table2 to autoexpand or vise versa when table1 is filled.
What Am I doing wrong?
Thank you!

(PostgreSQL) Stored Procedure to move data from Table1 to Table 2

How would you move all the data in Table1 to Table2 on PostgreSQL using a stored procedure when Table1 and Table2 have different column names (cannot simply JOIN).
Assume both tables are already made in the DB and the purpose is once data from Table1 is moved to Table2, Table1 gets wiped (using a trigger?), and assume Table2 is blank before any data is moved from Table1.
Please refer to image below for a simplified example.
Was thinking using a cursor in some way or form. Would that be efficient?
Much thanks!
Click for image sample

How to transfer data from one table to another randomly

Is it possible to put random values from table1.column1 (5rows) into table2.column2 (17 rows)?
What's more: column2 in table2 was added using alter table, so I have specific rows with ID and missing data only in that one added column.
example
image here

What is the expected match if more than one rows match on a join condition performing an update operation in postgresql?

Consider a query of this sort:
UPDATE table1 SET attr1 = table2.attr1 FROM table2 WHERE table1.attr3 = table2.attr3
Supposing there are duplicate attr3s in table2 and hence more than one rows that have a match with one single row of attr3 in table1, which row's attr1 will be assigned as table1's attr1?
I tried using an order by expecting that it will pick up the first match but I see that different matches are being picked up in different instances. Please let me know if I should add a sample data set if I did not make the scenario clear.
It always helps to read the manual:
In other words, a target row shouldn't join to more than one row from the other table(s). If it does, then only one of the join rows will be used to update the target row, but which one will be used is not readily predictable
(emphasis mine)
So the anwer to your question is: it's unpredictable

Is UPDATE without a JOIN possible?

I am trying to update a single column (all rows) from one table with a single value from another table. The problem is there is no index fields to join the tables on. Here is an example of the tables/columns in question (without data):
Table1: ID, Name, Address, Telephone, PriceList
Table2: PriceList, Description
I want to update Table1.Pricelist with the value in Table2.Pricelist
The current data I am testing with has one row in Table2 but it is possible for there to be more. In that case, I would just use the first value returned.
I thought I would post here to get the definitive answer as to whether this is possible.
update table1
set pricelist= (select top(1) table2.pricelist from table2);
UPDATE Table1
SET Pricelist = DLookup("PriceList", "Table2");
The DLookup expression will return a single value from Table2. So when Table2 contains only one row, it will give you the "first" PriceList value. However, with more rows in Table2, DLookup will still return one value but that may not come from the row which you consider to be the "first" row.
It would help to know how to identify which target row contains the PriceList value you want to use in the UPDATE.