How to refer to an ever expanding column of data automatically? - arrays

I have a column of data which contains a list of unique IDs.
There are a set of tabs which then uses this list to display various associated data against each ID.
Presently, any time a new ID is added, I must manually add the new ID to each subsidiary tab in order to get the data.
I'd like to do this automatically, such that an addition to the master list populates into the tabs. I don't know of a way with my (limited) knowledge of google sheets to do this, however- any ideas? :)
The basic way to do this is to initialize the first column in each tab with a simple '='Master List'!A1' and copy it down. This works, but if you sort the master list, it plays havoc with tabs.
Difficult to explain, but something like:
Master List tab
12
13
35
111
Data Tab #1
12 Orange
13 Pear
35 Apple
111 Dragonfruit
Data Tab #2
12 Orange
13 Green
35 Red
111 White
Data Tab #3
12 Tart
13 Juicy
35 Crisp
111 Dried
...now, if I add 140 to the Master List, I must (currently) manually populate Data Tab #1-3. I'd like it to populate automatically.
I update the Master List, and all associated Tabs show the new entry.

In each Data Tab, instead of
'='Master List'!A1' and copy it down
try
=arrayformula('Master List'!A1:A)
This is an array formula and does not need to be copied down. It will populate the entire column with the IDs.
This works nicely too:
={'Master List'!A:A}

try like this:
=INDIRECT("'Master List'!A1:A"&COUNTA('Master List'!A1:A))

Related

BlueSky, remove missing row

I'd like to remove a missing row of data. My data set looks like this (assume they all line up, and are imported from excel)
Canada 1 5 3
Afghanistan 3 7 2
Brazil 2 4 6
How do I remove the line for Afghanistan?
I'm using BlueSky 10.0.0, R package version 8, on windows 10. I want to remove the row, using BlueSky menu.
Thanks
I read a guide to blueSky, couldn't find how to do this. I searched stackoverflow, couldn't find how to do this. I might not know the right terms to use to search.
In the grid view of your data set, just choose the row with left mouse click
Then, with right mouse click you will get a menu to insert or delete a data row among others.

Populate dependent combox with Unique values VBA excel

I have created a user form for adding inventory.
I have 2 combobox in the form
Category = combobox1 (housekeeping, Electricals, Cafetria etc) for these categories I am populating combox1 with rowsource property
Itemsname - combobox2 - I want to populate this combobox based on the category selected in combobox 1
The problem I am facing is the items name repeat if there are more than 1 itemsname then all items name show up in the combobox2 which i dont want. I want to see unique values. I will give you example of entries
ColumnA(Category) ColumnB(itemsname) ColumnC (Vendorname)
Cafeteria Beans Cafe Coffee Day
Housekeeping liquid soap Sevak Industries
IT Monitors Infotech solutions
IT Keyboard Infotech solutions
IT Monitors Raj computers
see screenshot the above columns gets messed up : https://prnt.sc/10cbh30
Now in the above example I populate categories combobox 1 with unique values because number of categories are fixed so I have saved them separately and I pick them with rowsource
The main problem arises when I populate combobox 2 with items name. Same Item can be bought from different vendors so Monitors we are buying from different vendors so there are two entries. In combox 2 I see 2 entries of monitors but I want to see only one since the name is same.
Note I am using for loop and adding items in the loop in combobox 2 so it scans each entries of monitor twice so it adds up monitor twice
Can anyone help on this I am frustrated I cant figure out how to get unique values

how to format the specified cell value in two different formats in SSRS Report

I have SSRS report data where we will have two different thing in some of the cells, For example:
Old Values in SourceDB
FirstName LastName
Robin Son
BOB Alice
Updating the DB values:
FirstName LastName
Robin S
BOB A
After some update, we will have the changes and new & old values in Audit Table so the report will be created like this.
FirstName LastName
Robin was: Son now: S
BOB Was: Allice now: A
Is it possible to have the Was value in Red color and the now value in Green Color.
In worst case if it is not possible how to make the whole cell value into red.
Thanks for the suggestions or answers or even feedback's are appreciated.
If you can't change your Audit table per Ashiko's very sensible recommendation to hold the Was and Now values in seperate columns, you will need to parse out the relevant parts of your string value in your report.
One way you can do this is through placeholders that have expression based values. In your SSRS table, add 4 placeholders to a table that is based on your Audit dataset, with the following expressions as their Label and Value:
Was: - ="Was: "
Old Value - =replace(left(Fields!LastName.Value,instr(Fields!LastName.Value," Now:")-1),"Was: ","")
Now: - ="Now: "
New Value - =mid(Fields!LastName.Value,instrrev(Fields!LastName.Value,":")+2,99999)
You can then format the individual placeholder items as you would normal text, with some one colour and others another.
If you do this correctly, you should end up with something like this:
Design View:
Rendered:
Do be aware though, that if you do resort to splitting your string values in this manner, if that pattern you are searching for (eg: Now: in the old value or : in your new value) you will get undesirable results in your report.
If this is an entirely internal report for monitoring purposes, this is probably not an issue. If this will be customer facing however, I strongly recommend that you add additional columns to your Audit table for the Old and New value to allow you absolute control.
Did you try this?
Select the cell
Click F4 to open cell properties or right click the properties
In font tab , Select Color
4 Select Underneath Expression
5 Write as
=iif(Fields!ColumnName.Value = "WAS","Red","Green")

Create an array or list from text file and store values in labels (VB.net)

I have a text file with the following contents:
Andrew Law
32
6'1
123 Pounds
Tom Harris
19
5'5
180 Pounds
Randy Poffo
45
5'3
141 Pounds
Now on my form i have a listbox and four labels.
What i would like to do is have the listbox show only the names of the people in the text file (Andrew Law, Tom Harris, Randy Poffo) and when the user clicks the persons name in the listbox i would like each of the labels to show the corresponding details for that person (one label showing age, one showing their height and one showing their weight.)
I'm aware i could do this with a database however i would much prefer doing it by creating an array or list.
Any help would be so much appreciated!

Query to print all the nodes from the root to the given node in a binary tree stored in database in self referencing table [duplicate]

I have a bill of materials table that is set up like this:
item - parent
The end result when I display the bill of materials is that it is displayed like this:
item 1 - parent 0
item 2 - parent 1
item 3 - parent 1
The final result could also be multi level like this:
item 3 - parent 0
item 4 - parent 3
item 76 - parent 3
And it can go on ad infinitum:
item 76 - parent 0
item 46 - parent 76
item 46 - parent 0
item 25 - parent 46
Right now, I either just get 1 level from the database:
SELECT * FROM bom WHERE parentId = $itemId (shorthand)
Or pull every row from the table and use my recursive function to sort out just the ones I need, but this is obviously inefficient as I may only need 10 rows, but I pull 10,000 records. The output of the recursive function will just create a tree like this:
item 1
item 2
item 3
item 4
item 76
item 46
item 25
All I know is that I am starting at item 1. Item 5 could have a parent of 11; they do not have to go sequential. I want to get all of the child branches in the tree. How could I do this query in mysql?
Back in October 24, 2011, someone posted a question in the DBA StackExchange about tree traversal in MySQL. The SQL for MySQL cannot support it.
I wrote up three(3) Stored Procedures (GetParentIDByID, GetAncestry and GetFamilyTree) in my answer to that question. Hope this information helps you construct what you are looking for.
Bill Karwin has posted a slide show about heirarchical data in MySQL. If changing your database design is an option, there are some other appealing ways to store your data to make it easier to query. The approaches he covers are:
Adjacency List
Path Enumeration
Nested Sets
Closure Table
Slide 69 has a nice table showing the pros and cons of each method, so I suggest you look at that slide first to see which approach might work for you, then go back and look at the details of how to implement it. Note that the design you have chosen (adjacency list) is the only one of the four designs presented that makes it hard to query a subtree.
Having said that, if you can't change your design or you want to stick with the adjacency list then I have to agree with Didier that you should take a look at Quassnoi's article "Hierarchical queries in MySQL". It is a very clear article and explains how to write the query efficiently.
AFAIK, it is non trivial to do this with MySQL.
Here is a good set of articles about it:
http://explainextended.com/2009/03/17/hierarchical-queries-in-mysql/
MySQL (8) nowadays supports recursive queries.
Considering your table item(id, parent) and a starting item with id = 1, the following would do the job:
with recursive result(id, parent) as
(select id, parent
from item where id = 1
union all
select i.id, i.parent
from item i
join result on i.parent = result.id)
select * from result;

Resources