different translations according to a field in input file

41 views
Skip to first unread message

Mert Subulur

unread,
Jun 17, 2021, 7:52:18 AMJun 17
to Bots Open Source EDI Translator
hello all;
need your support. 

i have an input XML file, which contains delivery_type field. 

what is need is to root mapping regarding this field. 

if delivery_type = ZRL do mapping-1
else do mapping2

please find my code below; what am i missing ? 

def main(inn,out):

    for TRANSLATE in inn.getloop({'BOTSID':'ShippingOrderforSalesOrderDelivery'},{'BOTSID':'Header'}):
        delivery_type = TRANSLATE.get({'BOTSID':'Header','DeliveryType':None})

        if delivery_type != 'ZLR':
          
            return 'LUNDBECK_RRCPT_xml2xml' #alt-value is returned
        else:
         
                  
              
            for CTRL_SEG in inn.getloop({'BOTSID':'ShippingOrderforSalesOrderDelivery'}):
                out.put({'BOTSID':'ONE_ORD_I'},{'BOTSID':'CTRL_SEG','TRNNAM': 'ORDER_TRAN'})
                out.put({'BOTSID':'ONE_ORD_I'},{'BOTSID':'CTRL_SEG','TRNVER': '2010.2'})
                out.put({'BOTSID':'ONE_ORD_I'},{'BOTSID':'CTRL_SEG','WHSE_ID': 'TR_0126_06'})
                out.put({'BOTSID':'ONE_ORD_I'},{'BOTSID':'CTRL_SEG','CLIENT_ID':'CID002035'})

Eppye Bots

unread,
Jun 17, 2021, 7:57:38 AMJun 17
to 'Chuck Turco' via Bots Open Source EDI Translator
what does not work?

anyway, 3 different solutions:
1. in gramamars, via QUERIES  get 'alt' and use alt to setup differnte trasnlations
2. as you showed; think you have to discard results of first mapping (bots expects mapping to have a result)
3. use one mapping script, with different subroutiens for mapping1 and mapping2

kind regards, Henk-Jan Ebbers


--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/939781d8-132c-46fb-b35b-e39aa993f7b5n%40googlegroups.com.

Mert Subulur

unread,
Jun 17, 2021, 8:35:57 AMJun 17
to Bots Open Source EDI Translator
Hello;

i receive "no output message" error. for the "else" part. but when i remove if and run the mapping part after "else"  it works. 

one more question.. is any additional settings needed at bots web portal  ? 

17 Haziran 2021 Perşembe tarihinde saat 14:57:38 UTC+3 itibarıyla eppye şunları yazdı:

Eppye Bots

unread,
Jun 17, 2021, 8:44:12 AMJun 17
to 'Chuck Turco' via Bots Open Source EDI Translator
one more question.. is any additional settings needed at bots web portal  ?
no idea what that is?
 
kind regards, Henk-Jan Ebbers


Mert Subulur

unread,
Jun 18, 2021, 6:12:01 PMJun 18
to Bots Open Source EDI Translator
eppye, let me clarify my statement

regarding this;
2. as you showed; think you have to discard results of first mapping (bots expects mapping to have a result)

in my mapping;
 -  first i fetch deliverytype field.
-  if deliverytype is "ZLR" it means that there will be no alt translation. this works ok. 
- but if deliverytype is not "ZLR" i expect BOTS to run alt.mapping. but it generates no message. 

i couldnt find what is wrong...

not working part is;

 if delivery_type != 'ZLR':
          
            return 'LUNDBECK_RRCPT_xml2xml' #alt-value is returned

thanks for your help
17 Haziran 2021 Perşembe tarihinde saat 15:44:12 UTC+3 itibarıyla eppye şunları yazdı:

Mert Subulur

unread,
Jun 19, 2021, 5:53:46 AMJun 19
to Bots Open Source EDI Translator
Eppye;

i figured it out. i accomplished that using QUERIES in grammar. thanks for the tip




19 Haziran 2021 Cumartesi tarihinde saat 01:12:01 UTC+3 itibarıyla Mert Subulur şunları yazdı:
Reply all
Reply to author
Forward
0 new messages