Question

Can't save my results after a SQL Executor

  • 29 February 2016
  • 5 replies
  • 0 views

Badge

I have 2 tables A and B and want to increment the values from B using the last insert in A.

1- I am using the SQL Executor on B => select max(ID) from My_Table_A.

2- Then I merge B and the result from the the Sql Executor and save it as a shp file.

PROBLEM: the column ID exist now in B but is empty. I've try a lot of alternative and can't find why i am stuck whith this.

Thanxs for the answer i really need it


5 replies

Userlevel 2
Badge +16

I Think it is because of the function in the SQL statement.

Try Select max(ID) ID from My_Table_A.

This will rename the max(ID) to ID.

Userlevel 4

Hi

you may have to specify "ID" as an alias for the resulting attribute in your SQL, e.g.

select max(ID) as ID from My_Table_A

David

Userlevel 4

Try this SQL statement:

select max(GID)+1 as GID from BATIMENT

For "Attributes to expose" set "GID". Also set "Combine attributes" to "Keep result attributes if conflict".

The key here is to rename your max() function call to GID. Also be aware of potential upper/lower case attribute names.

You can also delete the FeatureMerger, you do not need it.

David

Badge

I Think it is because of the function in the SQL statement.

Try Select max(ID) ID from My_Table_A.

This will rename the max(ID) to ID.

Well it did work the second time i've tried. Thanxs :)

Badge

Try this SQL statement:

select max(GID)+1 as GID from BATIMENT

For "Attributes to expose" set "GID". Also set "Combine attributes" to "Keep result attributes if conflict".

The key here is to rename your max() function call to GID. Also be aware of potential upper/lower case attribute names.

You can also delete the FeatureMerger, you do not need it.

David

Ok thanks a lot! I've also used an attribute keeper to be shure ^^ Have a nice day

Reply