SUMIF in a Calculated Column in a pivot table in a Google Sheet gives "Argument must be a range." error - google-sheets-formula

I'm trying to create a calculated column that sums a column if another column equals something.
I am using this formula, which I think should work, but it's giving the error Argument must be a range..
=SUMIF(type, "a", age)
My sample data:
My pivot table with the error:

Related

Eloquent Intermediate Tabel with None Standard ID Column

While creating my database according to the eloquent standard, I ran into the problem that my table_name and id column name combined would be longer as 64 characters.
very_long_table_name.very_long_column_name_id
So I used a shorter column name as the foreign key in my Intermediate Table.
Migration file:
$table->unsignedBigInteger('short_id');
$table->foreign('short_id')->references('id')->on('very_long_table_name');
That worked fine, yet now I would like to insert a connection
Seeder.php:
$x->very_long_table_name()->attach($other_table_name->id);
I get the error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'very_long_column_name_id' in 'field list' (SQL: insert into very_long_table_name (just_an_id, very_long_column_name_id) values (1, 1))
What I would want is that it would use the column short_id instead of very_long_column_name_id to insert this, is there any cool way to fix this? or do I need to insert and query the connection manually if I keep the long names?
Like #Tim points out in the comments this needs to be done in the Model VeryLongTableName.php where you define the relationship:
public function very_long_table_name() {
return $this->belongsToMany(Model::class, 'very_long_table_name', 'local_id', 'short_id');
}

POWERQUERY : Deal with a column containing Text Values and Table

I am dealing with a column which is having Text Value mixed with Table data.
Table value
I would like to operate on this column by
if value = Table : aggregate the Table by combining the value with a comma separator
if value = : keep the original value
The result would be
I use this function to aggregate the value for Table, but I got an error when the value is a text
= Table.AggregateTableColumn(#"Lignes filtrées1", "value.1", {{"Element:Text", each Text.Combine(List.Transform(_, (x) => Text.From(x)), ", "), "Desired Result"}})
Would you have some tips to help me with this problem ?
Thanks in advance
It is hard to tell what you have in your table
As an example if the embedded table looked like this, with a single column
then you could add a column like
#"Added Custom" = Table.AddColumn(#"PriorStepName", "Custom", each try Text.Combine([Column1][TableColumn1],",") otherwise [Column1])
and get
If your table is more complicated you'd probably have to unpivot it first or otherwise give us a hint how to transform it into a single cell

Cascading LOV - Invalid number while updating record - Oracle Apex

I have a select list based on other select list. It works fine on the create screen but gives 'Invalid number' error in update screen.
SQL query:
select description, account_id
from t_account
where chart_id = :P15_chart_name
Please help me out!
You are trying to convert a string into a number, and that failed.
As Select List item has 2 values: 1st being display and the 2nd return value, it is the 2nd value that causes problems - account_id in your case.
For example, it contains value A while column that is supposed to accept this value is declared as NUMBER. Oracle can't convert A into a number and raises an error.
What to do?
make sure that Select List item LoV query returns only numbers, or
modify column's datatype to varchar2
If that's not it, then :P15_CHART_NAME item and chart_id table column differ in datatypes; a simple option is to fix page item's datatype.

Nifi throwing None of the fields in the record map to the columns defined by [table name]

Am trying execute a sql query on oracle database and inserting the result into another table, for my trial am just performing a simple query as
SELECT 1 AS count
FROM dual
and trying to insert that into a single column table which has the name COUNT.
The content of the record on Nifi seems to be as follows
[
{
"COUNT" : "1"
}
]
but the logs keeps throwing the error
due to java.sql.SQLDataException:
None of the fields in the record map to the columns defined by
the schema_name.table_name table:
any ideas ?
I believe you get that same error message if your table name doesn't match. The Translate Field Names property only translates the fields (columns), not the table name. Try specifying the schema/table in uppercase to match what Oracle is expecting.

Hive inserting values to an array complex type column

I am unable to append data to tables that contain an array column using insert into statements; the data type is array < varchar(200) >
Using jodbc I am unable to insert values into an array column by values like :
INSERT INTO demo.table (codes) VALUES (['a','b']);
does not recognises the "[" or "{" signs.
Using the array function like ...
INSERT INTO demo.table (codes) VALUES (array('a','b'));
I get the following error using array function:
Unable to create temp file for insert values Expression of type TOK_FUNCTION not supported in insert/values
Tried the workaround...
INSERT into demo.table (codes) select array('a','b');
unsuccessfully:
Failed to recognize predicate '<EOF>'. Failed rule: 'regularBody' in statement
How can I load array data into columns using jdbc ?
My Table has two columns: a STRING, b ARRAY<STRING>.
When I use #Kishore Kumar Suthar's method, I got this:
FAILED: ParseException line 1:33 cannot recognize input near '(' 'a' ',' in statement
But I find another way, and it works for me:
INSERT INTO test.table
SELECT "test1", ARRAY("123", "456", "789")
FROM dummy LIMIT 1;
dummy is any table which has atleast one row.
make a dummy table which has atleast one row.
INSERT INTO demo.table (codes) VALUES (array('a','b')) from dummy limit 1;
hive> select codes demo.table;
OK
["a","b"]
Time taken: 0.088 seconds, Fetched: 1 row(s)
Suppose I have a table employee containing the fields ID and Name.
I create another table employee_address with fields ID and Address. Address is a complex data of type array(string).
Here is how I can insert values into it:
insert into table employee_address select 1, 'Mark', 'Evans', ARRAY('NewYork','11th
avenue') from employee limit 1;
Here the table employee just acts as a dummy table. No data is copied from it. Its schema may not match employee_address. It doesn't matter.

Resources