Skip to main content
Closed

Don't name everything T1

Ester
K.Bakkenes
Arjan Sollie
Jeroen van den Belt
+42
  • Ester
    Ester
  • Andre te Raa
  • K.Bakkenes
    K.Bakkenes
  • Arjan Sollie
    Arjan Sollie
  • Jeroen van den Belt
    Jeroen van den Belt
  • Kevin Horst
    Kevin Horst
  • Harm Horstman
    Harm Horstman
  • Eric Franken
    Eric Franken
  • Robbert van Tongeren
    Robbert van Tongeren
  • Roy
    Roy
  • Mark Jongeling
    Mark Jongeling
  • Tom van Druten
    Tom van Druten
  • Jop ter Horst
    Jop ter Horst
  • Harold
    Harold
  • luukschouten
  • Roald
  • Dennis van Leeuwen
    Dennis van Leeuwen
  • Geurt
    Geurt
  • jjong
  • Roland
  • Ruben
    Ruben
  • Hugo
  • Freddy
    Freddy
  • Thomas Ofman
  • Remco Kort
    Remco Kort
  • Henno Tillema
  • J. de Lange
    J. de Lange
  • Suleyman
  • Jochem Pieper
    Jochem Pieper
  • KeesTap
  • Alban_T
  • Theo Neeskens
    Theo Neeskens
  • Rick
  • Anne Vries
  • Linde van Dyck
  • Allard Lakerveld
  • AndreKemmeren
    AndreKemmeren
  • Bart Huizer
  • Remco Duijsens
    Remco Duijsens
  • Marius Korff
    Marius Korff
  • rbiram
    rbiram
  • Theo Leijen
  • BramG
  • Eric
    Eric
  • Eric F
    Eric F
  • Ionut
    Ionut
  • pietervasbinder

For trouble shooting it would be much easier if not everything in the code was called T1. Trying to find the source of T1.[column_name] can be pretty time consuming since there are multiple T1 aliases used within the select statements created by the GUI. 

 

Did this topic help you find an answer to your question?

4 replies

Jeroen van den Belt
Administrator
Forum|alt.badge.img+9

Hi @Erwin Ekkel,

Can you elaborate a bit more on the actual idea, instead of the current situation? Do you have an example of code that is time consuming to troubleshoot? And what would you suggest as a solution to help clarifying things? Perhaps this will help you in gathering votes.


Forum|alt.badge.img+17
  • Author
  • Moderator
  • 778 replies
  • April 5, 2023

Here is a simple example of the role screen in the SF. Actual screens within end applications can have several T1's. Role is T1, Model is T1 and Branch is T1. Especially with the way the code is structured with sub query in sub query it can take some back tracking to find the source table of t1. The purpose of an alias is to make the code easier to read, not to confuse.

select t1.[model_id]
     , t1.[branch_id], t1.[role_id]
     , t1.[role_description]
     , t1.[all_rights]
     , t1.[insert_user]
     , t1.[insert_date_time]
     , t1.[update_user]
     , t1.[update_date_time]
     , t1.[generated_by_control_proc_id]
from [role] as t1
     left outer join (
select t1.[model_id], (t1.model_id
)
 as [model_id_display]
from [model] as t1
) as t2 on t1.[model_id] = t2.[model_id]
     left outer join (
select t1.[model_id], t1.[branch_id], (concat(t1.branch_id,
       case when exists (select 1 
                         from merge_session m
                         where t1.model_id = m.model_id 
                           and t1.branch_id in (m.merge_from_branch_id, m.merge_into_branch_id) 
                           and m.completed = 0)
            then ' (merging)'
            when t1.active = 0
            then ' (inactive)'
       end)
)
 as [branch_id_status]
from [branch] as t1
) as t3 on t1.[model_id] = t3.[model_id] and t1.[branch_id] = t3.[branch_id]
where (t1.[model_id] = 'DATECOM' and t1.[branch_id] = 'MAIN')
order by t2.[model_id_display], t3.[branch_id_status], t1.[role_id]


Forum|alt.badge.img+4

Hello Erwin,

The reason that every alias is t1 is a very conscious decision that was made for this reason:
 

https://docs.thinkwisesoftware.com/docs/sf/subjects_data#prefilter-type

 

And this also applies to expression columns:

https://docs.thinkwisesoftware.com/docs/sf/data_model#expression-dependencies

 

The alias used must at the very least be deterministic, otherwise it will be impossible to write SQL prefilters or expressions. They could be deterministic AND also more descriptive than they currently are, but this would be a breaking change — many existing SQL prefilters and expressions that use ‘t1’ would break. This alone makes this idea unfeasible in my eyes.


Mark Jongeling
Administrator
Forum|alt.badge.img+23
NewClosed

Reply


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