This is my very first computed View Method, and was wondering if someone would tell me if I am going in the correct direction.
The View name is ccv_HierarchyTreeTable (which uses the table - HierarchyTreeTable.). I am using the two fields [Path] and [Element Number]. I am using the computed field as a sort field, so I can get the data in the correct order for a grid view in a form.
It returns two different strings depending on if Path is blank or not (am I using the correct/best way of checking for a blank string?)
If I followed the example I took this from, I should have: public static server str cc_SortNode() -- why would it have server in that line?
Anyway - following is my code. Does it look correct? Anything else I need to know?
_________________
public static str cc_SortNode()
{
#define.ViewName(ccv_HierarchyTreeTable)
#define.DataSourceName("HierarchyTreeTable_1")
#define.FieldPath("Path")
#define.FieldElement("ElementNumber")
str sReturn,
sPath,
sElementNumber;
DictView dictView2;
dictView2 = new DictView(tableNum(#ViewName));
sPath = dictView2.computedColumnString
(#DataSourceName,
#FieldPath,
FieldNameGenerationMode::FieldList,
true);
sElementNumber = dictView2.computedColumnString
(#DataSourceName,
#FieldElementNumber,
FieldNameGenerationMode::FieldList,
true);
if (spath == "")
{
sReturn = sElementNumber + "!" + sElementNumber;
}
else
{
sReturn = sPath + sElementNumber;
{
return sReturn;
}
*This post is locked for comments