Skip to main content
Solved

@cursor_to_col_id with different columns in different screens


Forum|alt.badge.img+6

Hi I have to use the@cursor_to_col_id in my default for a view.
But that view is exposed on 2 seperate screens and both of them need a different column to get the focus.
But because it is a single view both screens will use the same default…
As far as I'm aware I cannot filter on variant either inside a default? Otherwise I could use 2 variants.
I can't retrieve the parent (both are details of a different parent) as well I think?

 

 

Best answer by Mark Jongeling

Hey Alban,

One trick you could use is a hidden column that has a default value in your View via its column settings. The View then can have two variants, let's say VariantA and VariantB. The default value for this column can then be altered in the respective variants. That value then can be used in the Default logic of the View.

Example, column named ref_location, in VariantA default value locationA, in VariantB default value locationB

Your code could then do the following:

if @cursor_from_col_id = 'columnA'
and @ref_location = 'locationA'
begin
    print 'A'
end

if @cursor_from_col_id = 'columnB'
and @ref_location = 'locationB'
begin
    print 'B'
end

So yes, the variant_id is not a given in the Default logic, but you can mimic that using this trick. An idea for that was raised here: variant_id for layouts, contexts, defaults | Thinkwise Community (thinkwisesoftware.com)

View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

4 replies

Mark Jongeling
Administrator
Forum|alt.badge.img+23
  • Administrator
  • 3936 replies
  • Answer
  • February 28, 2024

Hey Alban,

One trick you could use is a hidden column that has a default value in your View via its column settings. The View then can have two variants, let's say VariantA and VariantB. The default value for this column can then be altered in the respective variants. That value then can be used in the Default logic of the View.

Example, column named ref_location, in VariantA default value locationA, in VariantB default value locationB

Your code could then do the following:

if @cursor_from_col_id = 'columnA'
and @ref_location = 'locationA'
begin
    print 'A'
end

if @cursor_from_col_id = 'columnB'
and @ref_location = 'locationB'
begin
    print 'B'
end

So yes, the variant_id is not a given in the Default logic, but you can mimic that using this trick. An idea for that was raised here: variant_id for layouts, contexts, defaults | Thinkwise Community (thinkwisesoftware.com)


Forum|alt.badge.img+6
  • Author
  • Captain
  • 80 replies
  • February 28, 2024
Mark Jongeling wrote:

Hey Alban,

One trick you could use is a hidden column that has a default value in your View via its column settings. The View then can have two variants, let's say VariantA and VariantB. The default value for this column can then be altered in the respective variants. That value then can be used in the Default logic of the View.

Example, column named ref_location, in VariantA default value locationA, in VariantB default value locationB

Your code could then do the following:

if @cursor_from_col_id = 'columnA'
and @ref_location = 'locationA'
begin
    print 'A'
end

if @cursor_from_col_id = 'columnB'
and @ref_location = 'locationB'
begin
    print 'B'
end

So yes, the variant_id is not a given in the Default logic, but you can mimic that using this trick. An idea for that was raised here: variant_id for layouts, contexts, defaults | Thinkwise Community (thinkwisesoftware.com)

That's an interesting solution :) Thanks!!!!!


Forum|alt.badge.img+4
  • Warrior
  • 37 replies
  • March 6, 2024

Hey Mark, does this logic also apply to tables, or only to views? I'm trying to figure this out, but i cannot get this to work. I’ve defined a expresson column with default expression ‘select null’. This is overwritten on the column settings on the variant with a hard coded variant name, but the value is not filled out in the form, when i start editing a record.


Mark Jongeling
Administrator
Forum|alt.badge.img+23
BramG wrote:

Hey Mark, does this logic also apply to tables, or only to views? I'm trying to figure this out, but i cannot get this to work. I’ve defined a expresson column with default expression ‘select null’. This is overwritten on the column settings on the variant with a hard coded variant name, but the value is not filled out in the form, when i start editing a record.

Also works for tables. You say you use a default expression, as in the default value expression? It's better to use the expression query. The field itself can be set Hidden, but then always has the value set in the expression query. The default value expression is used for the database table as default value.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings