Hello,
I have looked at the example in the out-of-box solution for Asset Tracking (Asset tracking form.XSN) and I really would like to use the approach of dynamically sorting a repeated table.
I have tried to get it working half the night but I failed by now ;-((
Now I hope that someone can explain me the use of the code. My problem is the function 'compareAssets' in the following code:
I don“t know where I can define the parameters of the function --- in this case xmlAssetLeft and xmlAssetRight
function compareAssets(xmlAssetLeft, xmlAssetRight)
{
var xmlLeft = xmlAssetLeft.selectSingleNode(g_xpathSortBy);
var xmlRight = xmlAssetRight.selectSingleNode(g_xpathSortBy);
var valueLeft = getValue(xmlLeft);
var valueRight = getValue(xmlRight);
if ((valueLeft < valueRight) || (typeof(valueLeft) == "number" && typeof(valueRight) == "string"))
return -1;
else if ((valueLeft > valueRight) || (typeof(valueLeft) == "string" && typeof(valueRight) == "number"))
return 1;
else
return 0;
}
I have searched the whole script code for xmlAssetLeft and xmlAssetRight but the only place where they are used are in this function.
Does anyone know this sample in detail and can help me to understand this.
Thank you very much in advance