Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Noakes noakesey

View GitHub Profile
View generateUniqueReference.xpp
private static str lastUniqueReference;
/// <summary>
/// Get a unique numerical reference
/// </summary>
/// <returns>Unique numerical reference</returns>
public static str getUniqueReference()
{
str nextUniqueReference;
int retryCount = 0;
View reportPageModelTest.xpp
public class wwReportExampleTest extends SysTestCase
{
[SysTestMethodAttribute]
public void TestReport()
{
//Arrange
wwSysUserRoleInfoReportPage report =
wwSysUserRoleInfoReportPage::construct();
//Pass arguments here if the report has a contract
View reportPageModel.xpp
public class wwSysUserRoleInfoReportPage extends wwBaseReportPage
{
protected void new()
{
this.parmReportName(ssrsReportStr(SysUserRoleInfo, Report));
}
public static wwSysUserRoleInfoReportPage construct()
{
return new wwSysUserRoleInfoReportPage();
View renderSSRSToXMLInMemory.xpp
public void run()
{
//Configure the SrsReportRunController controller
controller.parmReportName(reportName);
controller.parmShowDialog(false);
controller.parmLoadFromSysLastValue(false);
controller.parmReportContract().parmReportServerConfig(SRSConfiguration::getDefaultServerConfiguration());
controller.parmReportContract().parmReportExecutionInfo(executionInfo);
//Associate the Rdp contract with prepopulated values if we have one
View gist:86c902476035b24b67fc351edf1cb7fb
protected XmlDocument xmlDocument;
protected Object contract;
protected str reportName;
protected SRSReportRunService srsReportRunService = new SrsReportRunService();
protected SRSReportExecutionInfo executionInfo = new SRSReportExecutionInfo();
protected SRSReportRunController controller = new SRSReportRunController();
public void run()
{
@noakesey
noakesey / IteratingXmlNodelList.xpp
Created Jan 25, 2019
Iterating an XML node list
View IteratingXmlNodelList.xpp
public boolean elementExists(str elementName, str attributeName, str attributeValue)
{
XmlNodeList nodes = xmlDocument.GetElementsByTagName(elementName);
XMLNodeListIterator iterator = new XMLNodeListIterator(nodes);
while (iterator.moreValues())
{
XmlElement e = iterator.value();
str val = e.getAttribute(attributeName);
@noakesey
noakesey / xpp
Created Dec 14, 2018
Subscribe to a multicast delegate
View xpp
[SubscribesTo(classStr(MyDelegateClass) delegateStr(MyDelegateClass, myDelegate))]
public static void delegateExample_myDelegate(real a, real b, EventHandlerResult result)
{
real total = a+b;
result.result(total);
}
@noakesey
noakesey / xpp
Last active Dec 14, 2018
Define a delegate
View xpp
void myMethod()
{
EventHandlerResult result = new EventHandlerResult();
this.nydelegate(1, 2, result);
var total = result.result();
}
delegate void myDelegate(real parm1, real parm2, EventHandlerResult result)
{
@noakesey
noakesey / xpp
Created Dec 14, 2018
Handling table events
View xpp
[DataEventHandler(tableStr(FMVehicle), DataEventType::ValidatedWrite)]
public static void FMVehicle_onValidatedWrite(Common sender, DataEventArgs e)
{
ValidatedEventArgs validateArgs = e as ValidatedEventArgs;
FMVehicle vehicle = sender as FMVehicle;
boolean result = validateArgs.parmValidateResult();
if (vehicle.NumberOfCylinders == 0)
{
result = checkFailed('Invalid number of cylinders.');
@noakesey
noakesey / xpp
Created Dec 14, 2018
Handling form control
View xpp
[FormControlEventHandler(formControlStr(FMVehicle, ShowVersions), FormControlEventType::Clicked)]
public static void ShowVersions_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormRun formRun = sender.formRun() as FormRun;
//etc…
}
You can’t perform that action at this time.