Okay
  Public Ticket #2788393
URL link as string from another column
Closed

Comments

  • Ryan Hoy started the conversation

    Background: Table connected to SQL database of 95,000+ rows

    I'm wondering if it is possible to set a URL column display text as a string from another column.

    What I mean is, is my second column is the title of a bid. The third column is the direct link to that bid posting source. Is there a way to href the title to include the url from the next column?

    For example, on Excel, this is done with the formula:

    =CONCATENATE("<a href=","""",A4,, """", ">", B4,"</a>") 

    where A4 would be the URL and B4 would be the hyperlinked display text of the URL.

  • [deleted] replied

    Hi Ryan

    Thank you for reaching out to us.

    You want an entry from the table as a hyperlink that would take the visitor to the specific post or page? That link would be dynamically generated by the content of the cell, right? 

    If that's true, you could use the CONCAT function, like this: 

    SELECT column1,column2,       
    CONCAT('<a href="www.yourwebsite.com/page1/',yourTable.column3,'">',yourtable.column3,'</a>') 
    AS HyperlinkFROM yourTable 

    This will create a hyperlink to www.yourwebsite.com/page1/value1 if there's "value1" entered as cell data in column3. On another row, it could be www.yourwebsite.com/page1/value2 if there's "value2" in the cell, and so on. So, this would be a hyperlink which could be shown in the modal, and it would take the user to the respective page.

    I hope this helps, do let us know if you need any further assistance.


  • Ryan Hoy replied

    Blaženka,

    The URL link does not have my domain URL, unfortunately. Every URL in the table is different.

    The SQL query I'm using is

    SELECT bid_bid.`bid_state`,
           bid_bid.`bid_scraper_id`,
           bid_bid.`bid_title`,
           bid_bid.`bid_link`,
           bid_bid.`bid_closing_date`
    FROM bid_bid

    bid_link is the URL. I am trying to set an href link for bid_title, where the href of bid_title is the link from in bid_link.

    Currently, I have the link set as a button (View Bid). Screenshot attached.

    Is it possible to set my column "Title" as an href, where the value is the URL contained in bid_link?

  • [deleted] replied

    Hi Ryan

    I am not sure how this can be achieved so I forwarded this to our development, they will be able to provide more information.

    I will update you as soon as I hear back from them.

    Thank you for your time and patience.


  • [deleted] replied

    Hi Ryan

    Thank you for your patience.

    You can try this

    SELECT bid_state, bid_scraper_id, CONCAT('<a href="',bid_bid.bid_link,'">,bid_bid.bit_title,'</a>') AS title_with_link, bid_closing_date FROM bid_bid

    I hope this helps, do let us know if there is anything else we can assist you with.

  • Ryan Hoy replied

    Blazenka,

    I think we are getting close. Getting an error when running this equation, though:

    cannot calculate position of ''bid_title'') AS title_with_link FROM bid_bid

    I also cleaned up the query a bit. I have it structured like this now:

    SELECT 'bid_state', 
        'bid_scraper_id',
        'bid_closing_date',
        CONCAT('<a href="'bid_link'">'bid_title'</a>') AS title_with_link
    FROM bid_bid

    (Without the CONCAT function, just listing the table names without the preceding database name works fine)


  • Ryan Hoy replied

    I got it!!

    Great video from your guys here on the CONCAT function. I didn't see this before..


    My final query was:

    SELECT bid_state, 
        bid_scraper_id,
        bid_closing_date,
        CONCAT('<a href="',bid_bid.bid_link,'" target="_blank">',bid_bid.bid_title,'</a>') AS title_with_link
    FROM bid_bid


    So the function is:

    CONCAT('<a href="',table.column,'">',table.column2,'</a>') AS describe_new_row

    Thank you for helping me out!!

  • [deleted] replied

    Hey Ryan

    I'm glad to hear thatsmile.png

    If you have any other issue or question please open new ticket, and we help you out.

    I’d like to ask you a favor. Would you mind taking a few minutes to write a review for us, please on this link

    Our free version is the only place where we can have proof for our hard work; your comments are beneficial for others to know what to expect when they’re looking for our plugin.

    Thank you in advance. It means a lot to us, and I am looking forward to reading your comment.