cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
anne_sa
Level VI

How to know if a table is a linked subset?

Hello everybody,

 

I would like to determine (using JSL) if the current data table is linked to a main table or not.

I tried "<< Get Table Variable Names" but it didn't work.

Do you have any idea of how we can get this information?

 

Thanks in advance for your help!

23 REPLIES 23
hogi
Level XI

Re: How to know if a table is a linked subset?

Wonderful

 

Will you add a functionality to cut the link?
functionality to cut the connection between a linked table and the main table 

Re: How to know if a table is a linked subset?

@hogi - Now that is a different request. From my understanding, the linkage is created (or not) at the time of table creation. That one is still being investigated. 

Craige_Hales
Super User

Re: How to know if a table is a linked subset?

Cutting the link means cloning the rows the subset table is sharing from the main table. The request of unlinking dtA could be prototyped with

  • use tables->subset to make a full copy of dtA into dtB
  • close dtA
  • rename dtB to dtA's name

which is imperfect because any platforms open on dtA lose their connection to the data. It might turn out to be quite a bit of C++ code for a fairly small set of use-cases.  @anne_sa  does explain a use case that might benefit. But that seems to open a different can-of-worms: suddenly add-in_1's linked table is no longer linked because add-in_2 unlinked it. I'm inclined to think being able to ask about the link status to decide if a clone is needed might be the sweet spot here.

Craige
hogi
Level XI

Re: How to know if a table is a linked subset?

If I try to concatenate tables with the option Append to first table,

the script stops with the message:

 

 

Cannot append to table: Big Class. Possible reasons for this include: the table is locked, the table is in a platform with a by group, or there is a linked subset of the table. in access or evaluation of 'Concatenate' , Concatenate(/*###*/Data Table( "Subset of Big Class" ),	Append to first table)

 

 

The error message was very helpful to identify the issue.
But how to make the script robust against linked subsets?

An addition function:

dt << get list of linked subsets()

will help. Then I can close the subsets via JSL.

 

Alternatives:

  • Jmp updates the linked data tables
  • Jmp cuts the link automatically
  • concatenate get a new option: Jmp_is_allowed_to_close_linked_data_tables_if_this_is_needed_to_run_this_concatenate(1)