20.05.2008, 19:05 | #1 |
Участник
|
axStart: InfoPath with default AIF file inbound offline
Источник: http://axstart.spaces.live.com/Blog/...C0A0!332.entry
============== Introduction Last week we were able to integrate InfoPath with the AIF File Inbound Adapter. Now it’s time for the final blow!
Offline working There is a general option on our Windows operation system that offers offline working. It is on the same place where you normally share a folder. Select Sharing, press Caching button and select option that makes it offline available. An offline map is actually some kind of file that exists on the client PC. It gets synchronized every time a network connection exists between the client and the server. Look at Window Start/All Programs/ Accessories/Synchronize (sorry for the Dutch layout). It contains my InfoPath document and one posted xml message. The user can synchronize manually, at log on or log off time. Pull down data in InfoPath Introduction It is possible to create pull down selection boxes in InfoPath. These pull down boxes can have predefined information or information from an external connection (web service, Database, XML). We will use the XML file. The trick is this: Create for every pull down menu an XML file. Below is an example of the ProjID. 40010 The Glass Bulb 40020 The Radiant Idea [FONT='Arial','sans-serif'] [/FONT] Create a XML files with AX:
{ ProjTable projTable; AifEntityKey aifEntityKey; List keyFields = SysDictTable::getUniqueIndexFields(tablenum(ProjTable)); AxdProjTable axdProjTable = AxdBase::newClassId(classnum(AxdProjTable)); AifEntityKeyList aifEntiryKeyList = new AifEntityKeyList(); AifDocumentXml aifDocumentXml; Map keyMap; //creating the xml file XmlReader xslt; XmlReader xml; XmlDocument xmlDocument; ; // add all records to be exported into the entity key list while select projTable { keyMap = SysDictTable::mapFieldIds2Values(keyFields,projTable); aifEntityKey = aifEntityKey::construct(); aifEntityKey.parmKeyDataMap(keyMap); aifEntityKey.parmTableId(projTable.TableId); aifEntityKey.parmRecId(projTable.RecId); aifEntiryKeyList.addEntityKey(aifEntityKey); } // create an xml document containg the records aifDocumentXml = axdProjTable.readList(aifEntiryKeyList, null, new AifEndpointActionPolicyInfo(), new AifConstraintListCollection(), connull()); //translate document with XSLT xml = XmlReader::newXml(aifDocumentXml); xslt = XmlReader::newFile('C:\AIF\code\xslt\ProjTable.xslt'); xmlDocument = xmlDocument::newXml(XmlTransform::execute(xslt,xml,false)); xmlDocument.save('C:\AIF\Inbound\xmlDatabase\ProjTable.xml'); } XSLT for translation of the ProjTable For details about XSLT look at other posts on this weblog. Using the xml (off line DB) in InfoPath Change field to Pull down Box
Testing Press Preview Button and test the Pull down. We have to repeat all these steps for Employee, Category and Activity. Creating Validation Logic in your InfoPath Form You can make field mandatory, and make changes on field trigger other fields. The rules that I used:
Point 7 & 8 are a little more complex. The information about Employee , Project and Activity relations are stored in AX (ProjValProjCategorySetUp + ProjValEmplProjSetup). This information needs also to be stored in an offline xml file. Example of a validation xml file (created with AX and XSLT) AFE 40010 ALT 40010 Programming the validation
Right click on the Proj ID field, select Programming/ Validate event. public void ProjId_Validating(object sender, XmlValidatingEventArgs e) { if (e.Site.Value != "") //validate event is also fired when form opens first time { XPathNavigator root = this.MainDataSource.CreateNavigator(); XPathNavigator EmplNode = root.SelectSingleNode("/ns1:Envelope/ns1:Body/ns2:ProjHours/ns2:ProjJournalTrans/ns2:EmplId", this.NamespaceManager); XPathNavigator ProjValEmplProjSetup = this.DataSources["ProjValEmplProjSetup"].CreateNavigator(); XPathNodeIterator ProjValEmplProjSetupResults = ProjValEmplProjSetup.Select("/ProjValEmplProjSetup/record[Projid=" + e.Site.Value + "]/EmplId"); while (ProjValEmplProjSetupResults.MoveNext()) { if (ProjValEmplProjSetupResults.Current.Value == EmplNode.Value) { return; } } e.ReportError(e.Site, false, "Employee is not allowed to post on this journal"); } } [FONT='Arial','sans-serif'] [/FONT] Conclusion: We have build an InfoPath document that interact with the AIF File Inbound Adapter. The concept has a lot of similarities with MS Snap and other solutions on the Internet. Personally I like this approach, because it is simple! Remember InfoPath is flexible it can act like a page in SharePoint or become part of outlook Also the performance of the file inbound with offline xml is higher. The only main difference is: My InfoPath has become a synchronic. But is this bad? Of course there are many other opinions about it. Chose the solution you and your customer trust and build it! download article in PDF format + code integration example with outlook Источник: http://axstart.spaces.live.com/Blog/...C0A0!332.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Похожие темы | ||||
Тема | Ответов | |||
axStart: When is my Label file updated in AX? | 8 | |||
axStart: Enrich AIF with the power of offline working (roadmap) | 0 |
Опции темы | Поиск в этой теме |
Опции просмотра | |
|