Toad Import - Change column value based on which excel worksheet the data came from - toad

I am trying to import to a table an excel file with 3 worksheets. For one of the columns I would like to vary the value populated based on which worksheet it came from. Is there a way to do this with Toad Import. The sheets look the same and have the same columns. But if it is sheet 1 I want a certain column to be be ABC, if sheet 2 XYZ, sheet 3 ETC. Is there a way?

I load Excel files frequently, but I didn't notice such an option. So I went to see the loader once again, step-by-step, checked carefully what it offers - nope, there's nothing like that.
A workaround, quite simple, is to edit the Excel file and create that column. Then
enter ABC into the first cell of that column
select the cell
double click the bottom right corner
it'll auto-populate all rows in that worksheet with ABC (in that column)
do the same for other sheets
Another option is to set column's default value, e.g.
alter table test modify ident varchar2(3) default 'abc';
You'd have to do that for each sheet you load, modify 'abc' to 'def' etc.
Or, if you switch to SQL*Loader (there's that option in the same menu as "Import table data"), create a control file which utilizes the CONSTANT keyword, e.g.
load data
infile excel.csv
append
into table test
fields terminated by ',' optionally enclosed by '"'
(name,
value,
ident constant "abc"
)
Just like in previous case, you'd have to modify the constant value before loading each worksheet's data.
Also, note that SQL*Loader can't load XLS file - you'd have to save each sheet into its own .csv file first.
Which option would I choose? Probably the first one; seems to be the simplest & the fastest.

Related

Cloud Data Fusion - trim quotes for all columns

I have a csv file in GCS with fields with hundreds of columns enclosed in quotes, like below :
"John","Doe","5/15/2021 7:18:26 PM"
I need to load this to BigQuery using Data fusion, created a pipeline. My question is
How do I trim quotes from these the columns in the Wrangler? I don't find much documentation for this, rather than the basic things
How do I apply this rule for all the columns in one shot.
Please guide me, any good reading on these kind of operations will also be helpful
For testing purposes I used your sample data and add a few more entries.
Remove quotes
If your data looks like this and your objective is to just remove the quotes from your data, what you can do is:
Click the drop down arrow beside body
Select Find and replace
At find put " and leave replace as blank
Your output will look like this:
Parse CSV to split into columns
You can then convert your CSV to columns:
Click the drop down beside body
Select Parse -> CSV
A pop up will appear and select "Comma"
This will tell your wrangler to read it as a CSV and split the comma to columns. But the original data will remain at column body.
To delete body:
Select body by ticking the check box at the right
Click the drop down beside body
Select Delete column
Your data should now look like this:

How do I make Power bi show all data as is and not as error?

I have a set of data ~36 000 rows from which in one column there are numbers and numbers with text (100567563; WT1632366; 3275-2422 etc.) I need it to show the data as it is. It's not an error and I have tried changing what the data is (text numbers general in excel and in Power bi with no success. Any tips?
In power bi ensure that you have the datatype of that column as text, It works absolutely fine for me.
Power Query previews the dataset, and determines the datatype from the first 1000 rows. From your question I'm going to assume that the first lot of previewed rows are numerical.
You can order your Excel file to have the first rows as 'WT1632366' then when it loads the data it will convert it to the text/string type, and load the numerical columns as text.
If you look in the query editor, you will see a 'changed type', you can see the column name and the format. In the below image I have a column called 'Data' you can change it from:
"Data", Int64.Type
to
"Data", type text
And it should load.
Note: If you insert a step after it that does this, it may still not load and error
In the image, the first 1200 rows are the number 1, the 1201 row is the text 'ABC' this will fail on load unless you change formating to text. You can do this by clicking on the column and clicking on the '123' and change it from the selection to text. If it asked to replace current step use that option.
Once the datatypes are set it will not reavelate them on later loads, so you don't have to worry about data type changes

Is there a way that POWERBI does not agregate all numeric data?

so, I got 3 xlsx full of data already treated, so I pretty much just got to display the data using the graphs. The problem seems to be, that Powerbi aggregates all numeric data (using: count, sum, etc.) In their community they suggest to create new measures, the thing is, in that case I HAVE TO CREATE A LOT OF MEASURES...Also, I tried to convert the data to text and even so, Powerbi counts it!!!
any help, pls?
There are several ways to tackle this:
When you pull a field into the field well for a visualisation, you can click the drop down in the field well and select "Don't summarize"
in the data model, select the column and on the ribbon select "don't summarize" as the summarization option in the Properties group.
The screenshot shows the field well option on the left and the data model options on the right, one for a numeric and one for a text field.
And, yes, you never want to use the implicit measures, i.e. the automatic calculations that Power BI creates. If you want to keep on top of what is being calculated, create your own measures, and yes, there will be many.
Edit: If by "aggregating" you are referring to the fact that text values will be grouped in a table (you don't see any duplicates), then you need to add a column with unique values to the table so all the duplicates of the text values show up. This can be done in the data source by adding an Index column, then using that Index column in the table and setting it to a very narrow with to make it invisible.

Toad for Oracle - Copy Column from Columns Tab without all details

An arbitrary behavior in Toad that annoys me when composing my queries.
It is not a problem really, rather than an annoying issue.
If you describe any table in toad, or clicked on the table name from the Schema Browser, in Columns tab, copy and paste a column
Sometimes you get the column name only, and sometimes you get the column name with the details of the column {name length data type...etc}
When does toad coy the column name alone, and when does it copy the entire column description?
I searched many SO questions for something related, and google trying to understand how to copy only column name, but I didn'y find any reference at all related tho this.
While in Schema Browser,
select any table and
navigate to "Columns" tab (that's what you're doing anyway).
Right-click, a menu should open.
It contains the Row select item. If it is checked, when copy/pasting a column, you'll actually copy the whole row.
Therefore, uncheck it.
Make sure you click on a column name when copy/pasting it; otherwise, you'll copy a column value you clicked on (such as Data Type or Null).

Excel 2013 List with link to another spreadsheet

I am trying to create a list box, That when I select a item in the list I am taken to a different spreadsheet and cell. Example If I pick "Pipe 1 inch" on my list it will open my spreadsheet called pipe and display the contents starting at cell A25. Then I would close that sheet and go back to my original spreadsheet, and choose something else "Pipe 2 inch" maybe located at cell A45 in the other spreadsheet.
I'm not sure you can do exactly what you've described here.
Let's say you create a lookup range of Pipe 1 options in columns A25:A27 of worksheet 'Pipe 1'. Then you create another lookup range of Pipe 2 options in columns A45:A48 of worksheet 'Pipe 2'.
If you use worksheet 'Pipe Orders', with two columns in it called Pipe1 and Pipe2, you can then tie-in those lookup lists to each cell in those columns
Select the top open cell of the Pipe1 column. Under the Data tab, select DataValidation. Under the settings tab of that dialog that opens, under the 'Allow' list, select 'List'. The source box appears and you can enter: 'Pipe 1'$A$25:$A$27, then choose OK. The single quotes tell Excel to use that particular spreadsheet.
Do the same thing for the next cell over on your Pipe Orders worksheet, which will be the Pipe2 column. This time when creating your lookup list, use 'Pipe 2'$A$45:$A$48.
You can copy the cell formatting down the page of your Pipe Orders columns to copy this behavior.
This does not give you the links to the other pages, but at least gives you the values. I experimented a bit with using hyperlinks in the cells for the lookup values, which do work from there, but the links didn't transfer to the pull-down list.