you may find some instances where you want to save some additional data on the form w.r.to a user. Following example shows how you can implement this coding pattern to save last values on the form.
For any specific Implementation related queries shoot your questions at lokesh_kant@hotmail.com
- Identify the list of variables that you want to save with user’s Usage data.
- Implement following code
public class FormRun extends ObjectRun{ str x;
#define.CurrentVersion(1)
#localmacro.CurrentList
x
#endmacro
}
public void initParmDefault(){ if(!x)
x= “DEFAULT”;
}
public dataAreaId lastValueDataAreaId(){ return curext();
}
public userId lastValueUserId(){ return curuserid();
}
public UtilElementType lastValueType(){ return UtilElementType::Form;
}
public identifiername lastValueElementName(){return this.name();} public identifiername lastValueDesignName(){return element.args().menuItemName();} public boolean unpack(container packedClass){int version = RunBase::getVersion(packedClass);;switch (version){case #CurrentVersion:[version,#CurrentList] = packedClass; return true;
default:
return false;
}
return false;
}
public void init(){super();// xctrl.text(“DEFAULT”);xSysLastValue::getLast(element);} public void run(){super();if(x)xctrl.text(x);// sxctrl is a string control on the form.} public container pack(){ return [#CurrentVersion,#CurrentList];
}
public void close(){ super();
x= xctrl.text();
xSysLastValue::saveLast(element);
}