This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,920 Users
  • 2,269,775 Discussions
  • 7,916,823 Comments

Discussions

How can I conditionally display entries in a column as links only if a query does not come up empty?

Pearl
Pearl Member Posts: 14 Green Ribbon

I have a table that looks like the following:

The SQL query I used for this interactive report (static ID = 'STEM') is as follows:

select MOCKSTEMS.WORD_ID,
       MOCKSTEMS.STEM_ID,
       MOCKSTEMS.LABSTEM,
       MOCKSTEMS.LABSTEMCATEGORY,
       MOCKLEMMAS.LEMMAFORM,
       MOCKSTEMS.LEMMA_ID,
       MOCKWORDS.ORIGINALWORD,
       MOCKSTEMS.CONTAINEDIN
from MOCKSTEMS
inner join MOCKWORDS on MOCKSTEMS.WORD_ID = MOCKWORDS.WORD_ID
inner join MOCKLEMMAS on MOCKSTEMS.LEMMA_ID = MOCKLEMMAS.LEMMA_ID

There are 2 interactive reports on this page; the other one (static ID = 'MORPH') has the following query:

select MOCKSTEMS.WORD_ID,
       MOCKSTEMS.STEM_ID,
       MOCKMORPHS.MORPHEME_ID,
       MOCKMORPHS.LABMORPHEME,
       MOCKMORPHS.LABMORPHEMECATEGORY,
       MOCKLEMMAS.LEMMAFORM,
       MOCKMORPHS.LEMMA_ID,
       MOCKWORDS.ORIGINALWORD
from MOCKMORPHS
inner join MOCKSTEMS on MOCKMORPHS.STEM_ID = MOCKSTEMS.STEM_ID
inner join MOCKWORDS on MOCKSTEMS.WORD_ID = MOCKWORDS.WORD_ID
inner join MOCKLEMMAS on MOCKMORPHS.LEMMA_ID = MOCKLEMMAS.LEMMA_ID

Currently, the 'Lab Stem' column contains links that applies a filter on each of the 2 interactive reports on this page (page 11):

However, I only want to display the entry as a link (i.e. in blue text) if there are results in either the STEM interactive report or the MORPH interactive report with the filters applied.

How can I do this?

I'm thinking I could create a column in my SQL query that counts the number of rows that would satisfy my condition, but I'm not quite sure how to incorporate that into my current SQL query.

Any help would be appreciated. Thank you!

Answers