I have a derived field that strips an FDA Recall Number from RecallProduct.ProductDescription and uses it to build an HTML link, passing the recall number to the FDA Recall Number search page. This works fine for the on-screen list; the link opens to the correct site in a new tab. But when it's exported to a CSV and saved as an Excel workbook, it shows the HTML text instead of a functioning link.
Is it possible to modify the LPL for the derived field, or for this lists that include the field, so that it displays the link onscreen, but shows only the actual FDA Recall Number when exported to a CSV?
ChatGPT recommends the "IsExportContext()" function. This is not documented in the LPL guide I have. However, when I added this to the LPL for the derived field, the function was not highlighted as an error. But I was not able to figure out how to use the function within my LPL code.
Here's the current LPL for the derived field.
RecallProduct is a BusinessClass
owned by recall
Derived Fields
FDARecallNumber is a DerivedField
type is RichText
if (CastProdDescToAlpha[20:24] = "To be")
return CastProdDescToAlpha[20:35]
else
if (CastProdDescToAlpha[21:21] = "-" and CastProdDescToAlpha[26:26] = "-")
return "<a href=\"https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfRES/res.cfm?start_search=1&RecallNumber=" + CastProdDescToAlpha[20:30] + "\" target=\"_blank\">" + CastProdDescToAlpha[20:30] + "</a>"
else
return ""