• Resolved Dave

    (@dnuttall)


    I have the WPDA 3.0.2 working on a current version of WordPress, using a view that includes two unique hyperlinks, of which one is “local” to the WP $HOME and the other off-site.

    Both show as expected when the publication type is MODAL. I would like to have them be ACTIVE/clickable.

    Is that possible?

    TIA.
    Dave

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dave,

    You can do this, but you need to define these columns as hyperlinks in your table settings. You will also need to format these columns correctly. There is a topic in which this issue was discussed, you can find it here:
    https://www.ads-software.com/support/topic/calculated-field-column-in-db-list/

    Can you add your view definition? Maybe I can help.

    Thanks,
    Peter

    Thread Starter Dave

    (@dnuttall)

    Hi Peter,
    Here is the core of my view.
    Fields that I would like to have as active hyperlinks are:
    c_songtitles.hymnary_org_url
    and
    c_mtracks.url
    – – –
    select
    c_songtitles.st_id AS st_id,
    c_songtitles.st_title AS st_title,
    c_songtitles.st_genre AS st_genre,
    c_songtitles.music_key AS music_key,
    c_songtitles.hymnary_org_url AS hymnary_org_url,
    c_song_genres.id AS id,
    c_song_genres.genre AS genre,
    midi_sequencers.ms_id AS ms_id,
    midi_sequencers.ms_name AS ms_name,
    c_mtracks.mst_id AS mst_id,
    c_mtracks.sequencer_id AS sequencer_id,
    c_mtracks.url AS url,
    midi_voicing.mv_id AS mv_id,
    midi_instrumentation.mi_id AS mi_id,
    midi_voicing.mv_desc AS mv_desc,
    midi_instrumentation.mi_desc AS mi_desc
    from (((((c_songtitles
    join c_song_genres)
    join midi_sequencers)
    join c_mtracks)
    join midi_voicing)
    join midi_instrumentation)
    where
    (
    (c_mtracks.mst_id = c_songtitles.st_id) and
    (c_mtracks.sequencer_id = midi_sequencers.ms_id) and
    (c_song_genres.id = c_songtitles.st_genre) and
    (c_mtracks.voicing = midi_voicing.mv_id) and
    (c_mtracks.instrumentation = midi_instrumentation.mi_id)
    )
    order by
    c_songtitles.st_title
    – – – – –
    TIA.
    Dave

    • This reply was modified 4 years, 8 months ago by Dave.
    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dave,

    There are two ways to handle this.

    (1) Turn your column into a hyperlink column

    To do this you need to add some json to that column. The plugin needs this format:

    {
    	"label" : "your-label",
    	"url" : "your-url",
    	"target" : "_blank"
    }

    After that you need to tell the plugin to handle the column as a hyperlink in table settings:
    – Go to the Data Explorer
    – Click on the Manage of your table
    – Click Settings
    – Click Column Settings
    – Select hyperlink as the column type
    – Save your settings

    You can add json to your column like this:
    concat('{"label":"',first_name,'","url":"https://wordpress.local/wp-admin/admin.php?page=wpda&table_name=authors&action=listtable&wpda_s=',first_name,'","target":""}') as url

    If you tell me what your url should look like, I can help!

    (2) Wait a few days and use the new feature “dynamic hyperlink”s”

    This feature allows you to add hyperlinks to your table or view and allows the substitution of column values in your url. Much easier… ??

    I really finished it just this morning! I have to fix a few minor thing before I can put it online. But it won’t take more than just a few days.

    Best regards,
    Peter

    Thread Starter Dave

    (@dnuttall)

    It is becoming CLEARER, Peter!
    But WHERE does the JSON get added to the column?
    Thanks.
    Dave

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dave,

    You can add it to your create view statement, like this:

    SELECT
      column1,
      column2,
      concat('{"label":"',your-label,'","url":"your-url","target":""}') as url
      column3,
    FROM
      view_name;

    Best regards,
    Peter

    Thread Starter Dave

    (@dnuttall)

    I don’t recognize what should be substituted in that concat string, except that “target” will likely be “_blank”.

    Does label = the field name and url/your-url = the data?

    Sorry to be so “dense between the ears”!
    d.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dave,

    Maybe you can start to just add a hardcoded url column to your select and add dynamic data when it works.

    Add this column to your view:
    '{"label":"search","url":"https://www.google.com/","target":"_blank"}' as url
    It is hardcode, so you can copy and paste it into your script file.

    After that:
    – Start the Data Explorer
    – Click on the Manage link of your view
    – Click Settings
    – Click Column Settings
    – Select hyperlink for the new column url
    – Save your settings

    Test your view! And let me know if that works…

    Best regards,
    Peter

    Thread Starter Dave

    (@dnuttall)

    OK!
    Hard-coded URL works but the concat() string MUST have a “comma” at the end of the line.

    I’m guessing now that what you’re working on MIGHT provide the ability to replace the hard-coded URL with the actual data in a selected field?

    I’m “all in” for something like that! And can wait until the “coronavirus” comes around and then I have to run because I’m 15 years past the youngest members of the high-risk group!

    THANKS, Peter!
    d.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dave,

    Don’t give up! You’re almost there… ??

    With concat you can now add your own data to the json string. Please change the previous hardcoded url to this:

    concat(
      '{"label":"search","url":"',
      c_songtitles.hymnary_org_url,
      '","target":"_blank"}') as url

    Let me know if it works! ??

    Best regards,
    Peter

    Thread Starter Dave

    (@dnuttall)

    Peter,
    The explicit table.fieldname (c_songtitles.hymnary_org_url) does NOT work;
    HOWEVER, the ALIAS works PERFECTLY!

    What a dream come true!
    I’ve been fooling with “custom fields” and FAILING.

    I think the appropriate expression (perhaps outdated) is: YOU da bomb, Peter!

    THANKS!
    d.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Great! ??

    I’ll release the next version this week. I’ll let you know when it is available. You might consider to use the new dynamic hyperlink feature anyway.

    Best regards,
    Peter

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Dave,

    Just wanted to let you know that version 3.0.3 supports dynamic hyperlinks. You’ll just need to update the plugin to make it available.

    You can find more info about the new feature here:
    https://wpdataaccess.com/2020/03/22/dynamic-hyperlinks/

    Best regards,
    Peter

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to make data items clickable?’ is closed to new replies.