How can I add columns of data from one table to another from a lookup ID number in CSV/Excel? - sql

I am trying to recreate an old ASP member directory and put it into a Wordpress plugin (Ultimate Member) and need to change the data structure before importing.
I exported the old data into a CSV/Excel file that has a couple tables(sheets):
Member info table containing 4,000 members (each has a Firm ID field (a number i.e. 344); multiple members can belong to a Firm)
Firm table with 1,000 firms (first field is Firm ID)
In the old app the Firm ID number in the Member table calls up all of the fields from the Firm table. I need this to be all in one table to import. If I did this manually I would have to look at the Firm ID number for all 4,000 members and then paste in that firms fields from the Firm table into the Member table. Is there an easier way to do it?

If I understand correctly, you have a column A with all members, a column B with all IDs and you need a column C with the names if the firms.
If your firm list is in the same document in a second sheet (let's say 'Sheet2', you can type in cell C2:
=vlookup(B2;Sheet2!A:B;2;FALSE)
Then just drag the cell down (double click on the bottom right corner)

Related

MS Access - Enter Parameter Value on INSERT INTO

I have a database, which contains information that I can't share images of due to compliance reasons.
I have a table I need to copy data from, so I was using the following SQL:
INSERT INTO completedtrainingstestfinal (MALicenseNum)
SELECT MALicenseNum
FROM CompletedTrainings
WHERE (CompletedTrainings.MALicenseNum IS NOT NULL)
AND (CompletedTrainings.Employee = completedtrainingstestfinal.Employee);
It keeps popping up the Enter Parameter Value, centered on the new table (named completedtrainingstestfinal) at the Employee column.
Background: The original table is a mess, and this is to be the replacement table, I've had to pivot the table in order to clean it up, and am now trying to remove an ungodly amount of nulls. The goal is to clean up the query process for the end users of this who need to put in training and certification/recertification through the forms.
When you look in the old table, it has been designed to reference another table and display the actual names, but as seen in the image below it is storing the data as the integer number Employee.
The new table Employee column was a direct copy but only displays the integer, my instincts tell me that the problem is here, but I have been unable to find a solution. Anyone have any suggestions to throw me in the right direction?
Edited to add: It might be an issue where the tables have different numbers of rows?
This is the design view of the two relevant tables :
Table 1
Table 2

Create list of display fields and checkbox fields from a table column in Oracle Apex

I am trying to create a list of display fields and checkbox fields from a table column in Oracle Apex. For example, let's say I have a Table A. These are the values stored in A.
ID Health Conditions
-- -----------------
1 Heart Disease
2 High Blood Pressure
3 Diabetes
So now I want to display these 3 display fields associated with 3 checkboxes so the users can choose whether they have the above health conditions problems. If Table A has n values, then I can dynamically display n fields with n checkboxes. How can I do this?
The way I understood the problem, you should pre-populate table (which will contain info about those health conditions) and display the whole list as Interactive Grid (or Tabular Form, depending on Apex version you use).
It means that you'd store non-checked values as well (though, you could delete such rows on submit).
Alternatively, if you create an "empty" Interactive Grid page and let users add rows, and for each row select health condition they have, you'd store only selected values.
Yet another option is to create a page with shuttle item (or select list that allows multiple selections) so that user would select only desired values and store them. Drowback of such an approach is that all values are stored into the same column (read: it is not normalized) separated by colons. That's OK for selecting values, but causes problems later when you have to do something with it as you have to first split values into rows and then do that something.

VBA For Auto Fill

I want to be able to choose a value in E4 on the Invoice (which must have a drop down list of Client ID, Then I want the Client Name to populate into B5 the client address into B6, The vat number into B7, Terms into E6
All the info must come from the Customer sheet as shown in the picture
Column A: Client no (ID100)
Column B: Client Name
Column C: Client Address
Column D: Vat No
Column E : Terms
I have tried everything but I cant seem to get it right, My knowledge is limited but I did write the invoice program....with help from the internet
Customer list:
Invoice:
This is deceptively simple if you stretch the boundaries of your preferred solution a little bit. Instead of entering data in E4, use a combo box. Set the source row as the ID100 column. - Your ID Column only lists unique IDs with no duplicates right?
If there are duplicates in the ID field then you have three choices.
Overhaul the table and clean your data
Take a day or week or a weekday to really think about how you want select and/or display the extra information and handle the that you'll encounter complexities
3 Give the project to someone else
I recommend the combobox because
The combo box can intellitype/autofill as you type
The autofill perk doesn't misspell, or display anything that isn't in that column that means any lookup is a guaranteed return if the user is not being a dill
You aren't looking anything up until the ID is populated so this control acts as an um..... well.... control. It's a great starting trigger.
using the combobox results you simply use your favorite lookup to get the row number (vlookup, match, find, filter, you get the point)
now grab the values from the community you need and populate the cells.
Done! Easy right?

Dynamic Length Excel Tables with Formatting Driven from Dynamic Source Tables

My current setup:
Users need to create reports in Excel which can contain various components like tables, charts etc. These report components are driven off large source tables which are provided to the workbook via a web service. Each source table lives on its own worksheet and the report components live on a separate sheet called "front_sheet".
A greatly simplified example is as follows:
On "input_sheet_1" there is a table which looks like so
The user would then like to create two tables for the report (on "front_sheet") which reference the table on input_sheet_1, that look like this:
These "output" tables contain columns which aren't on the source table (Total Spend) but they may contain more columns such as "Price in euros" where the "price" column is multiplied by some constant.
The table rows are also colour coordinated by their Category. Also there is a "Total" at the bottom of the output tables.
This is easy to do when the input table is static. However I do not know how to deal with this when the input table has a variable number of rows i.e. each time the workbook is refreshed the basket will have different numbers of different items.
Does anyone know how I can achieve this? A requirement is that the user setting up the report does not have to write any VBA at all.
Thanks for taking the time to read this.

how to display parent record and children from multiple tables

I have three tables, 1 parent with 2 child table 1-to-many relationships.
table 1: People
table 2: Phone numbers (any number of records)
table 3: email adresses (any number of records)
I would like a report looking like this:
Person1:
First_Name-------Last_Name
phone1:------12345----Home
phone2:------54321----work
mail1:-------first#mail.com----work
mail2:-------first#mail.com----work
mail3:-------first#mail.com----work
Person2:
-------First_Name-------Last_Name
phone1:------12345----Home
phone2:------54321----work
mail1:-------first#mail.com----work
mail2:-------first#mail.com----work
mail3:-------first#mail.com----work
I would very much like to do this using reporting services.
Edit: I know how to link all tables with left joins, I don't have a concept as how to get this done.
OK, here's a sort of summary of how you need to approach it. I can't give you a step-by-step because it would be impossibly long, but this should get you started. (Also note that I'm doing this from memory):
You will need three datasets, one each for people, phone numbers, and email addresses. I am going to assume that the phone numbers and email addresses have some kind of ID field in common, some way to tie people to phones and to email addresses. You will need that field in your datasets.
You don't need to do any joins in your SQL: the linking between the three datasets will be done within the report.
Put a Matrix on your report. Have it draw from the People dataset. Put the first and last name in the detail row of the Matrix.
Add a new detail row to your Matrix, under your first and last name.
Merge the cells in your new detail row so that you have one very wide cell.
Embed (drag and drop) a new Matrix in the single wide cell in your new detail row.
Link your matrix to the Phones dataset. Set up a record filter in the matrix to limit the records to those that match the ID field in the parent matrix.
Set up the Phones as you want in the embedded child Matrix.
Repeat steps 3-7 with the Email Addresses dataset.
You don't actually need to do any grouping (unless you want to include subtotals of some kind), because you're not actually grouping anything: you're just displaying a list with embedded sub-lists.