Jump to content

Conditionally Display a Link Based on Value of Field in Tabular Results Page


Recommended Posts

Hello, 

   I have very little Java experience and am relatively new to Caspio.  I have read through all the postings on this forum and have tried as much as I can.

My problem is this: I need to display a link on a line of a tabular report results page based on the value of a field in the line.

Description:

   The line consists of information about members in a family. The family can have any number of members. One of the members is the primary member and that is indicated by a value of 'Yes' in a checkbox stored in the database. I want only the primary member to have the link to the pantry page and the other member lines to just display a blank space. This is to prevent pantry items being added for all the members when there can be only one pantry item per day for the group.

I would like to see:

John Smith  Yes  link_to_pantry

Jane Smith   No   blank

Jimmy Smith  No  blank 

Is this even possible? 

Thank you for any help you can provide. I am really stuck.

Leigh

Additional Info: I have tried the following in a calculated field, but can't get it to display a link:

CASE
    WHEN [@field:Primary_Client] = 1 THEN '<a href="https://c3afw034.caspio.com/dp.asp?AppKey=a2dc40005863d83f783a4981a28b&GBurg_Household_ID=[@field:GBurg_Household_ID]">Pantry</a>'

    WHEN [@field:Primary_Client] = 0 THEN ' '

    ELSE 'OKAY'
END

It displays the link code for the correct entry, but doesn't just display Pantry with a line under it.

Edited by Leigh
Additional Info
Link to comment
Share on other sites

I have resolved this by putting the code in an HTML block:

 

<script>
if ("[@field:Primary_Client]" == "Yes") {
document.write("<a href='https://c3afw034.caspio.com/dp.asp?AppKey=appkeyhere&Household_ID=[@field:Household_ID]'>Pantry</a>");
}
else {
document.write("  ");
}
</script>

Link to comment
Share on other sites

  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...