Hi, im trying to retrieve the parent_row_id from a newly added row. However @ and T1 both dont work. Anyone knows how I should fix this?
select top 1 step_nr + 1from calculation_step--where calculation_method_id = t1.calculation_method_id «order by step_nr desc
Best answer by Mark Jongeling
Okay, that clears it up. I'm afraid you will not be able to use t1. nor @something, because Default value expressions cannot do that: Data model | Thinkwise Documentation
Query - The expression used to determine the default value. The query cannot use values from a new record.
Examples: getdate() or dateadd(month, 1, getdate())
The correct way to do what you would like to achieve is using Default logic. In here you can access all the data of the current row and you will be able to set the column value.
It will most likely be similar to this:
1if @cursor_from_col_idisnull-- Initially
2and@default_mode=0-- Insert
3or@step_nrisnull-- If for some reason it has no value, set a value
When adding a new calculation step row it should take the maxvalue step_nr and add + 1. It should filter on the calculation_method_id, because steps belong to methods.
Okay, that clears it up. I'm afraid you will not be able to use t1. nor @something, because Default value expressions cannot do that: Data model | Thinkwise Documentation
Query - The expression used to determine the default value. The query cannot use values from a new record.
Examples: getdate() or dateadd(month, 1, getdate())
The correct way to do what you would like to achieve is using Default logic. In here you can access all the data of the current row and you will be able to set the column value.
It will most likely be similar to this:
1if @cursor_from_col_idisnull-- Initially
2and@default_mode=0-- Insert
3or@step_nrisnull-- If for some reason it has no value, set a value
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.