Good day.
I've encountered an issue with the current Javascript Copy Logic used in 2 of the Lansa Axes Documentation for USERENV and Generic Coding(https://axesdocs.lansa.com.au/index.php ... RhdGEiXQ==) and Iterating through subfiles entries(https://axesdocs.lansa.com.au/index.ph ... es-entries).
These 2 AXES Documentation both used window.clipboardData logic which works on IE but doesn't work on Chrome or Firefox. I've also confirmed this while investigating online.
Please see sample logic below:
Code: Select all
window.clipboardData.clearData();
if (sClipData != "") window.clipboardData.setData("Text",sClipData);
Please see logic below:
Iterating through subfiles entries - Updated Logic(https://axesdocs.lansa.com.au/index.ph ... es-entries)
Code: Select all
var sClipData = "";
var sTab = "\t";
var iSFLIndex = 1;
var oEmployee = FIELDS("Employee",iSFLIndex);
while (oEmployee !== null)
{
var oSurname = FIELDS("Surname",iSFLIndex);
var oGivenName = FIELDS("Given_Name",iSFLIndex);
sClipData += oEmployee.getValue() + sTab;
if (oSurname !== null) sClipData += oSurname.getValue() + sTab;
else sClipData += "UNKNOWN" + sTab;
if (oGivenName !== null) sClipData += oGivenName.getValue() + sTab;
else sClipData += "UNKNOWN" + sTab;
sClipData += "\n";
iSFLIndex += 1;
oEmployee = FIELDS("Employee",iSFLIndex);
}
var textArea = document.createElement("textarea");
textArea.value = sClipData;
textArea.style.opacity = "0";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
alert('Copying text command was ' + msg);
} catch (err) {
alert('Unable to copy value , error : ' + err.message);
}
document.body.removeChild(textArea);
Code: Select all
sendSubfiletoClipBoard : function(oP)
{
var iSFLIndex = 0;
var iLimit = oP.sendFields.length;
var sClipData = "";
var sTab = "\t";
var sNL = "\n";
var oiterField = null;
iSFLIndex = 1;
oiterField = oP.ENV.FIELDS(oP.iterField,iSFLIndex);
while (oiterField !== null)
{
for (var i = 0; i < iLimit; i++)
{
var osendField = oP.ENV.FIELDS(oP.sendFields[i],iSFLIndex);
if (osendField !== null) sClipData += osendField.getValue() + sTab;
else sClipData += oP.notFound + sTab;
}
sClipData += sNL;
iSFLIndex += 1;
oiterField = oP.ENV.FIELDS(oP.iterField,iSFLIndex);
}
//window.clipboardData.clearData();
//if (sClipData !== "") window.clipboardData.setData("Text",sClipData);
alert(sClipData);
var textArea = document.createElement("textarea");
textArea.value = sClipData;
textArea.style.opacity = "0";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
alert('Copying text command was ' + msg);
} catch (err) {
alert('Unable to copy value , error : ' + err.message);
}
document.body.removeChild(textArea);
}, /* <= Note the comma */
Firefox Chrome Thanks.
Kind Regards,
Rigor