Topic
  • 5 replies
  • Latest Post - ‏2014-03-11T15:53:48Z by GaudencioPuyo
GaudencioPuyo
GaudencioPuyo
3 Posts

Pinned topic Unusual Attribute Naming Causes dxl errors

‏2014-03-11T10:49:40Z | attribute naming

Hi all,

I have named my enumeration type attribute like this "Supplier -> Customer". I later found out that I run into dxl errors whenever I refer to those attributes. E.g. my dxl is to count how many of "value1"s are under that attribute: eq(attr(Suppler->Customer),'value1')... gives me "invalid structure" error. Is there a workaround to this or do I need to rename all my attribute across all my 50+ modules?

Many thanks!

  • M_vdLaan
    M_vdLaan
    31 Posts
    ACCEPTED ANSWER

    Re: Unusual Attribute Naming Causes dxl errors

    ‏2014-03-11T12:00:42Z  

    Yes, I made sure, as the same dxl works fine if I change the attribute name to refer to another attribute. (By the way I'm just new to dxl). If this persists, maybe I can just search around the forums (or ask here) and look for a dxl which allows me to rename said attribute across target multiple modules/directory.

    Cheers!

    Hello GuadencioPuyo,

     

    Its' always wise to avoid punctuation and other weird characters in attibute names. I strongly suggest renaming the attributes. It will bite you some day...

    Here's a little snippet to get you started. Make sure you open the module(s), then call the renameAttr function, then save and close the module. This example uses the current module so you can test it.

     

    Good luck,

    Marcel

     

     
    string renameAttr(Module mod, string sOldName, sNewName)
    {
      if (!isEdit(mod)) {
        return "The module should be opened in exclusive edit mode."
      }
    
      AttrDef ad = find(mod, sOldName)
      if (null ad) {
        return "The attribute '" sOldName "' could not be found."
      }
    
      modify(ad, setName, sNewName)
    
      return null string
    }
    
    string sErr = renameAttr(current Module, "Suppler->Customer","SupplierToCustomer")
    if (!null sErr) {
      print "ERROR: " sErr "\n" 
    }
    else {
      print "Done." 
    }
    

     

  • adevicq
    adevicq
    154 Posts

    Re: Unusual Attribute Naming Causes dxl errors

    ‏2014-03-11T11:02:17Z  

    Hi,

    I have made a quick test and there is no issue with such attribute names.

    Have you put quotes around the string???? "Suppler->Customer"

    Regards,

  • GaudencioPuyo
    GaudencioPuyo
    3 Posts

    Re: Unusual Attribute Naming Causes dxl errors

    ‏2014-03-11T11:13:37Z  
    • adevicq
    • ‏2014-03-11T11:02:17Z

    Hi,

    I have made a quick test and there is no issue with such attribute names.

    Have you put quotes around the string???? "Suppler->Customer"

    Regards,

    Yes, I made sure, as the same dxl works fine if I change the attribute name to refer to another attribute. (By the way I'm just new to dxl). If this persists, maybe I can just search around the forums (or ask here) and look for a dxl which allows me to rename said attribute across target multiple modules/directory.

    Cheers!

  • adevicq
    adevicq
    154 Posts

    Re: Unusual Attribute Naming Causes dxl errors

    ‏2014-03-11T11:26:46Z  

    Yes, I made sure, as the same dxl works fine if I change the attribute name to refer to another attribute. (By the way I'm just new to dxl). If this persists, maybe I can just search around the forums (or ask here) and look for a dxl which allows me to rename said attribute across target multiple modules/directory.

    Cheers!

    But if you write:

    o."Suppler->Customer" = "kjlkjljk"

    or

    string s = o."Suppler->Customer"

    there is no problem...

    Therefore the issue must be somewhere else.

    Updated on 2014-03-11T11:38:39Z at 2014-03-11T11:38:39Z by adevicq
  • M_vdLaan
    M_vdLaan
    31 Posts

    Re: Unusual Attribute Naming Causes dxl errors

    ‏2014-03-11T12:00:42Z  

    Yes, I made sure, as the same dxl works fine if I change the attribute name to refer to another attribute. (By the way I'm just new to dxl). If this persists, maybe I can just search around the forums (or ask here) and look for a dxl which allows me to rename said attribute across target multiple modules/directory.

    Cheers!

    Hello GuadencioPuyo,

     

    Its' always wise to avoid punctuation and other weird characters in attibute names. I strongly suggest renaming the attributes. It will bite you some day...

    Here's a little snippet to get you started. Make sure you open the module(s), then call the renameAttr function, then save and close the module. This example uses the current module so you can test it.

     

    Good luck,

    Marcel

     

     
    string renameAttr(Module mod, string sOldName, sNewName)
    {
      if (!isEdit(mod)) {
        return "The module should be opened in exclusive edit mode."
      }
    
      AttrDef ad = find(mod, sOldName)
      if (null ad) {
        return "The attribute '" sOldName "' could not be found."
      }
    
      modify(ad, setName, sNewName)
    
      return null string
    }
    
    string sErr = renameAttr(current Module, "Suppler->Customer","SupplierToCustomer")
    if (!null sErr) {
      print "ERROR: " sErr "\n" 
    }
    else {
      print "Done." 
    }
    

     

  • GaudencioPuyo
    GaudencioPuyo
    3 Posts

    Re: Unusual Attribute Naming Causes dxl errors

    ‏2014-03-11T15:53:48Z  
    • M_vdLaan
    • ‏2014-03-11T12:00:42Z

    Hello GuadencioPuyo,

     

    Its' always wise to avoid punctuation and other weird characters in attibute names. I strongly suggest renaming the attributes. It will bite you some day...

    Here's a little snippet to get you started. Make sure you open the module(s), then call the renameAttr function, then save and close the module. This example uses the current module so you can test it.

     

    Good luck,

    Marcel

     

     
    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">string renameAttr(Module mod, string sOldName, sNewName) { if (!isEdit(mod)) { return "The module should be opened in exclusive edit mode." } AttrDef ad = find(mod, sOldName) if (null ad) { return "The attribute '" sOldName "' could not be found." } modify(ad, setName, sNewName) return null string } string sErr = renameAttr(current Module, "Suppler->Customer","SupplierToCustomer") if (!null sErr) { print "ERROR: " sErr "\n" } else { print "Done." } </pre>

     

    Sorted it eventually. Thank you all for the support.

    Cheers,