Jump to content

How to query the information links contained in each template in the database?


Mark123
Go to solution Solved by David Boot-Olazabal,

Recommended Posts

Nice weekends,every one

    Now, I can select all information of item_type='dxp' or item_type='query' through SQL in SQL Server.

    image.png.7b6abd3a1bda79176c735d0da644e398.png

   But I don't know how to correspond the two, that is, which information links each template corresponds to.

   Is there any way or certain field to achieve it?

Link to comment
Share on other sites

42 minutes ago, David Boot-Olazabal said:

Hi Mark,

Not sure if I understand your question correctly.
Do you mean that you want to know, which information link is related to item_type=query or item_type=dxp?

Or do you mean something else? In that case, can you elaborate a bit more what you are trying to achieve?

Kind regards,

David

Thank you for your reply.

There are multiple templates in the library, and each template data comes from multiple information links.
How to select each template and its corresponding information link in SpotfireDB.
As shown in the following figure:

image.png.814c7ab3438363b4e04a928ca6c84f5d.png

Link to comment
Share on other sites

  • Solution

Hi Mark,

Right, so you want to see which information links are connected to a dxp file.
You can try this query:
 

SELECT 
lib1.ITEM_ID,
lib1.TITLE,
lib1.DESCRIPTION,
lib1.ITEM_TYPE,
lib2.TITLE as IL
FROM	
[spotfire_server144].[dbo].[LIB_RESOLVED_DEPEND] libdep 
join [spotfire_server144].[dbo].[LIB_ITEMS] Lib1 on libdep.DEPENDENT_ID = lib1.ITEM_ID
join [spotfire_server144].[dbo].[LIB_ITEMS] Lib2 on lib2.ITEM_ID = libdep.REQUIRED_ID
WHERE 
lib1.ITEM_TYPE = (SELECT TYPE_ID FROM LIB_ITEM_TYPES WHERE LABEL in ('dxp'))
and lib1.Title like 'Bikes%'
and lib2.ITEM_TYPE = (SELECT TYPE_ID FROM LIB_ITEM_TYPES WHERE LABEL in ('query'))
ORDER BY
lib1.ITEM_TYPE, lib1.TITLE

In my example, I have a dashboard that starts with the name Bikes (you can either try this with one of your dxp title names, or just remove that 'Where clause' part if you want all dxp's to be listed).
The result of the above query is (there is only 1 information link used in my Bikes demo analysis file):
image.png.332744786a06f64aa7a3784122d16de1.png

Kind regards,

David

  • Like 1
Link to comment
Share on other sites

18 hours ago, David Boot-Olazabal said:

Hi Mark,

Right, so you want to see which information links are connected to a dxp file.
You can try this query:
 

SELECT 
lib1.ITEM_ID,
lib1.TITLE,
lib1.DESCRIPTION,
lib1.ITEM_TYPE,
lib2.TITLE as IL
FROM	
[spotfire_server144].[dbo].[LIB_RESOLVED_DEPEND] libdep 
join [spotfire_server144].[dbo].[LIB_ITEMS] Lib1 on libdep.DEPENDENT_ID = lib1.ITEM_ID
join [spotfire_server144].[dbo].[LIB_ITEMS] Lib2 on lib2.ITEM_ID = libdep.REQUIRED_ID
WHERE 
lib1.ITEM_TYPE = (SELECT TYPE_ID FROM LIB_ITEM_TYPES WHERE LABEL in ('dxp'))
and lib1.Title like 'Bikes%'
and lib2.ITEM_TYPE = (SELECT TYPE_ID FROM LIB_ITEM_TYPES WHERE LABEL in ('query'))
ORDER BY
lib1.ITEM_TYPE, lib1.TITLE

In my example, I have a dashboard that starts with the name Bikes (you can either try this with one of your dxp title names, or just remove that 'Where clause' part if you want all dxp's to be listed).
The result of the above query is (there is only 1 information link used in my Bikes demo analysis file):
image.png.332744786a06f64aa7a3784122d16de1.png

Kind regards,

David

Something is confusing.

I have chosen a template named ‘控制模版’ that contains multiple information links, but the SQL query you provided only yielded one result.

image.thumb.png.c3295c0b75942010c0b80b919f689a33.pngimage.thumb.png.3e37b4247d68fe2153141e2c456f8281.png

Link to comment
Share on other sites

Hi Mark,

That is strange, because when I run this query on a dashboard 'user_actions' (which I have three times in my repo in various folders/forms), I get this result back:
image.thumb.png.8388f652307c73a166781dc4c4fecad4.png

You may also want to checkout this article, where the lib_resolved_depend table is a bit explained as well giving you another way of querying the Spotfire database: https://support.tibco.com/s/article/How-to-query-Spotfire-database-to-get-the-item-names-on-which-a-particular-analysis-file-depends-on (in fact, searching for lib_resolved_depend on https://support.tibco.com will present you with more queries that may be of use).

This is the output of that (smaller query), when I use the highlighted ITEM_ID as input (the TITLE column holds the name of the Information Links, the DISPLAY_NAME is the item type):
image.png.3bddb2e9995c3878c44750cee82e6394.png

Kind regards,

David

Link to comment
Share on other sites

Thank you for your patience.

I may have found the problem that some information links in the templates have been abandoned.

I will look for a few more templates to confirm.And I guess there shouldn't be any problem.
Thank you again for your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...