Thanks Jesper!
exactly what I needed.
With this i can put any value in and insert the record.

....logging off from Yahoo, to start programming!

/B


--- In development-axapta@yahoogroups.com, <[EMAIL PROTECTED]> 
wrote:
>
> Hi there
> 
>  
> 
> I have solved it a bit different, but you would be able to 
construct your scenario based on my code.
> 
>  
> 
> I got a XML document with the table name or an alias for the table 
as XML element, as child elements I got the fields and needs to 
create a record in Axapta based on this.
> 
>  
> 
> void A()
> 
> {
> 
>     FileName                fileName = 'File Name goes hier';
> 
>     XMLDocument             importData;
> 
>     XMLNode                 xmlNode;
> 
>     XMLNode                 node;
> 
>     XMLNodeListIterator     XMLNodeListIterator;
> 
>     Counter                 XMLNodeCounter;
> 
>     SysDictTable            dictTable;
> 
>     Common                  record;
> 
>     boolean                 valueFound;
> 
>     fieldId                 field;
> 
>     ;
> 
>     // Open XML Document
> 
>     importData = new XMLDocument();
> 
>     importData.Async(true);
> 
>     importData.load(filename);
> 
>     if (importData.readyState() == 4)
> 
>     {
> 
>         // get first Node
> 
>         xmlNode = importData.documentElement();
> 
>         XMLNodeListIterator = new XMLNodeListIterator
(xmlNode.childNodes());
> 
>         ttsbegin;
> 
>         // get child Nodes
> 
>         while (XMLNodeListIterator.moreValues())
> 
>         {
> 
>             node = XMLNodeListIterator.value();
> 
>             if (TableName2Id(Node.attributes().nextNode().text()) > 
0)
> 
>             {
> 
>                 // First Element holds the table
> 
>                 dictTable = new SysDictTable(tableName2Id
(Node.attributes().nextNode().text()));
> 
>                 valueFound = false;
> 
>                 record = dictTable.makeRecord();
> 
>                 // child elements holds the fields with values
> 
>                 for (XMLNodeCounter = 0; XMLNodeCounter < 
node.childNodes().length(); XMLNodeCounter++)
> 
>                 {
> 
>                     // Node name = FIeld Name
> 
>                     field = dictTable.fieldName2Id(node.childNodes
().item(XMLNodeCounter).attributes().nextNode().text());
> 
>                     if (field
> 
>                     &&  !isSysID(field))
> 
>                     {
> 
>                         // get the node value
> 
>                         record.(field) = node.childNodes().item
(XMLNodeCounter).getNodeValue();
> 
>                         valueFound = true;
> 
>                     }
> 
>                 }
> 
>                 if (valueFound)
> 
>                 {
> 
>                     record.insert();
> 
>                 }
> 
>             }
> 
>             XMLNodeListIterator.nextValue();
> 
>         }
> 
>         ttscommit;
> 
>     }
> 
> }
> 
>  
> 
> Mit freundlichen Grüßen / Best regards / Med venlig hilsen
> 
>  
> 
> Jesper Jørgensen / Abt. NMT-XD
> Entwicklung Axapta
> 
> arvato systems | Technologies GmbH 
> An der Autobahn 18 
> 33311 Gütersloh 
> 
> [EMAIL PROTECTED] <blocked::mailto:[EMAIL PROTECTED]> 
> 
> http://www.as-T.biz
> 
>  
> 
> Phone:   +49 5242 / 40 80 54
> 
> Fax:       +49 5242 / 40 80 40
> 
> Mobile:  +49 172  / 571 03 34
> 
> ________________________________
> 
> "Der Inhalt dieser Nachricht oder eventueller Anlagen ist 
vertraulich und ausschließlich für den bezeichneten Adressaten 
bestimmt. Bitte stellen Sie sicher, dass die Information in dieser 
Nachricht ausschließlich an die adressierten Personen gelangt. Sollte 
diese Nachricht versehentlich an Sie gesendet worden sein, dann 
informieren Sie bitte umgehend den Absender und löschen Sie die 
Nachricht. Vielen Dank." 
> 
> "The information in this e-mail and any attachments is 
confidential. The information must only be held in areas that have 
controlled and limited access to the addressed persons. If this e-
mail has been sent to you in error, please immediately notify the 
sender and delete the e-mail. Thanks."
> 
> ________________________________
> 
> ________________________________
> 
> Von: development-axapta@yahoogroups.com [mailto:development-
[EMAIL PROTECTED] Im Auftrag von surfing2alien
> Gesendet: Mittwoch, 3. Januar 2007 23:53
> An: development-axapta@yahoogroups.com
> Betreff: [development-axapta] Update field with switch-case
> 
>  
> 
> I'm looking for an example where I can find the way to achieve the
> following.
> Can somebody tell me , or point to an example in Axapta 3.0, what to
> fill in 
> in the dots in method B , and how method A should look like:
> 
> I receive a fieldid from a message in method A.
> This fieldid is validated by another method B, and there is a 
switch-case 
> which tells what the fieldtype is.
> Depending on the type of field in method B, 1 of the fields in my
> Table in 
> method A has to be updated.
> 
> method A()
> 
> XMLmessage XMLmessage;
> Table Table;
> ;
> receives a XMLmessage.
> In this XML message the fieldtype is extracted
> 
> call method B
> 
> method B()
> 
> switch fieldtype
> {
> case MName : return..... ; break;
> case MAge : return..... ; break;
> case MAdress : return..... ; break;
> case MCity : return..... ; break;
> .
> .
> .
> default : return.......; break;
> }
> 
> (back in method A)
> 
> depending on the fieldtype, one of the fields in the Table has to 
be 
> inserted with the value
> which is extracted after the fieldtype in the message.
> 
> Thanks
> /B
> 
>  
> 
> 
> 
> [Non-text portions of this message have been removed]
>


Reply via email to