Friday, November 19, 2010

Bypassing Validation

To test my IIR Form, I needed to bypass all the Infopath required fields. My method was simple enough, I saved a copy of the form to a local drive as testbeta.xml, and then replaced the input for the webservice with an xmldocument type taht loaded the test form...

xmlDoc := XmlDocument.Create;
xmlDoc.Load('C:\testbeta.xml');
Root := TParticipantRecord.Create;
// Root.LoadFromXML(Root,IIRForm);
Root.LoadFromXML(Root,xmlDoc);

Friday, November 12, 2010

The Roadmap

Big...Huge...Gigantic...

I’ve been asked for an expanded vision for ESSC I.T.

I get the understanding that the gloves are off and we need to push forward under the assumption that the resources can be found, likely using grants and such. Considering the mess that C.A.D.D.I.S and the boys from Oracle left behind it is both exciting and a bit frightening to consider that little old me might be allowed to take a shot where all the old gods failed…

The key, in my own mind, is to decouple the different parts into something far more flexible than tradition allows, balancing the rigor of the ‘reported’ data entry with the ad-hoc nature of InfoPath forms services.

Thursday, November 4, 2010

Drop Dead Drop Downs



When consuming a dataset created from a table with a key and description, by selecting at the top element and splitting the value and display, we can get a return value in the xmlDocument to post the foreign key and bind the joins together.

In this case the segment of xml is like:




->editregion
id->1
Desc->North Los Angeles
vpid->1227
vpname->Kolenda, Kathleen
vpstring->Kolenda, Kathleen
->/editregion


Then if the default value is -1, the value returned can be handled by determining if the result sent is a -1, in which case the source for VPName is the value (or in this case the VP’s Employee ID Number). What is funky is that the VPName will be the Display Name rather than the value if it’s an edit but if left untouched the VPName will be the Display Value. My solution is to load the table with a VPString field that doesn’t show and has the original name so that if they don’t match I know to use the VPName field but if they do I can use the VPID field.

With this code segment to load the repeating group in the main data section, I can get around the funkyness…


function LoadESSCRegions()
{ // Get the list of Services. var
regions = Document.GetDOM("AsRegionsList").selectNodes("//REGIONS");

// If nothing was found, then return; there will be no items to
insert.
if(regions == null)
{

XDocument.UI.Alert("Error-> Unable to load Regions List");
return;
}

var reg;

while
(reg = regions.nextNode())
{
var row =
XDocument.DOM.selectSingleNode("//my:myFields/my:RegionsTable/my:EditRegions");
row = row.cloneNode(true);
row.selectSingleNode("my:ESSCRegion_ID").text
= reg.selectSingleNode("ESSCRegion_ID").text;
row.selectSingleNode("my:RegionDescription").text =
reg.selectSingleNode("Description").text;
row.selectSingleNode("my:RegionIsActive").text =
reg.selectSingleNode("IsActive").text;
if (reg.selectSingleNode("RVP") ==
null)
row.selectSingleNode("my:RVPID").text = "-1"
else
row.selectSingleNode("my:RVPID").text = reg.selectSingleNode("RVP").text;

if (reg.selectSingleNode("NAME") == null)
row.selectSingleNode("my:RVPString").text = ""
else
row.selectSingleNode("my:RVPString").text =
reg.selectSingleNode("NAME").text;

var parent =
XDocument.DOM.selectSingleNode("//my:myFields/my:RegionsTable");
parent.appendChild(row);
}

}