11 Replies Latest reply on Feb 9, 2021 4:55 AM by Vaishali Ahlawat

    Finding Items with or without Attributes

    Vaishali Ahlawat Guru

      Hi Experts,

       

      I want to query P360 to find Items which have attributes and don't have attributes .

       

      As per our system we have some attributes coming from external source and some are Structure Feature Groups associated with Items .

       

      I want to create a report telling if the external source sent us attributes or not ?

       

      Now, I tried creating an export template but because all attribute fields are qualified by attribute name key, its specific to 1 attribute .

       

      Could anyone please help with some suggestions or directions toward the same to achieve it ?

       

      dwalterdavenacy

       

      Thanks,

       

      Vaishali

        • 1. Re: Finding Items with or without Attributes
          Dave Nacy Guru

          Vaishali,

           

          You don't have to qualify the attribute name on export, you just need the right kind of data source list.

           

          Not sure if this is exactly what you're looking for, but start with an Item list and just call a sub-module set to export all Item Attributes:

           

           

           

          I'd write it out and import it into Excel, filtering for attributes with no values. You can also identify attributes with missing values via DQ rules.

           

          Hope this helps,

          Dave

          • 2. Re: Finding Items with or without Attributes
            Vaishali Ahlawat Guru

            Hi Dave ,

             

            Thanks a lot for the response .

             

            I tried using sub module and I tried taking an export by comparing the null and non null attributes names , even the values but problem is even if an item does not have attributes from external source it has them from structure feature groups (pre defined ) but I want to filter out only items which has attributes from external source or not .

             

            If in current setup OOB its not possible , Is there a way that we could create a field may be check box "has attribute" at item level saying yes or no ?

            Really appreciate any suggestions .

             

            davenacy SBeutler, dwalter

             

            Thanks,

            Vaishali

            • 3. Re: Finding Items with or without Attributes
              SBeutler New Member

              Hi Vaishali,

               

              can you explain how you can distinguish between attributes from external source and those that are not from external source? How can you see that in the UI?

              If I have got it right, both types of attributes are mapped to structure group features. But what is the difference of both?

               

              Sabine.

              • 4. Re: Finding Items with or without Attributes
                Vaishali Ahlawat Guru

                Hi Sabine,

                 

                The difference I can see among them is few fields like attribute group code, the attribute coming from external source has these values but not the ones internally.

                 

                When I see them in Web UI, it shows me all attributes having values.

                 

                Now,data is something like this:

                 

                1)Items having only Structure feature Group attributes

                 

                2) Items having Structure feature Group attributes and the ones coming from the source.

                 

                So, the attributes coming from source have the values and one internally kept dont have them (except one).

                 

                I tried the export comparing attribute group code and values both to null and not null but problem is when it compares null values it finds non null values as well for 2nd kind of Items and hence gives me items.

                • 5. Re: Finding Items with or without Attributes
                  Vaishali Ahlawat Guru

                  This is how I have tried this (tried with ifempty function as well):

                   

                   

                  Submodule:

                  {?ValueSet "AttrChk",{?Compare {&Attribute values.Attribute Value Code (English, DEFAULT)},"","Null",""}}{!}{?IfEmptyThen {?ValueGet "AttrChk"},"Attributes Available"}

                   

                   

                  Module:

                  {?ValueSet "Chk",{?Compare {$Attributes},"","",{&Item.EDC}|{&Item.AS400 Brand Name}}}{!}{?ValueGet "Chk"}

                   

                  Really appreciate the help !

                  Thanks,

                   

                  Vaishali

                  • 6. Re: Finding Items with or without Attributes
                    Vaishali Ahlawat Guru

                    Hi ,

                     

                    We have 2 predefined DQ rules as well:

                    CheckMandatoryValues

                    CheckMissingAttributes

                     

                    davenacy

                     

                    As you mentioned we can check if attributes have values or not but I tried running CheckMandatoryValues rule but it gives me OK even if attributes have no values, am I missing smthng here?

                    Do I need to change something in the rule ? I ran it as it comes .

                     

                     

                    Thanks,

                    Vaishali

                    • 7. Re: Finding Items with or without Attributes
                      Daniel Walter Guru

                      Hey,

                       

                      some details:

                      CheckMissingAttributes

                           - checks if the item has an attribute, or not, if there is a structure group feature (independent of value)

                      CheckMandatoryValues

                            - this checks if the attribute has a value, if the structure group feature is mandatory. This is a checkbox on the future group list.

                       

                       

                      Not sure I understand completely the query you are looking for, but I'd suggest having a look at the search as well.

                      In the search it is no longer mandatory to fill out the qualifiers, so you can search across attributes.

                       

                      So you could search for items which have something which is always there like the data type, but no value.

                      That would give you the list of items which have an attribute wich is empty.

                       

                      Once saved this query can also be used from the web UI.

                       

                      Best,

                      Daniel

                       

                       

                       

                       

                      1 of 1 people found this helpful
                      • 8. Re: Finding Items with or without Attributes
                        SBeutler New Member

                        Using the search is a good idea and maybe more handy than creating an export

                         

                        But because I have invested some time, I would like to share my findings with you.

                         

                        I think it is more a tricky logical problem than a technical one to get the information exported.

                         

                        As I don't have your code field, I've just used the attribute name field instead to classify my items into "good" and "bad" ones. If you collect the information if an item has any attribute with a name and any attribute without a name and combine that information, you should get the answers you want.

                         

                        If an item has attributes with names and no attributes without names, it has only attributes with names - it's a good item.

                         

                        If an item has attributes without names and no attributes with names, it has only attributes without names - it's a bad item.

                         

                        If an item has attributes with names and attributes without names, we are not able to classify that item as good or bad.

                         

                         

                        This is my submodule content:

                         

                         

                        {?ValueSet  "nameMissing", {?IfEmptyThen {&Attributes.Name (English)}, "x"}{?ValueGet "nameMissing"}}{!

                         

                        }{?ValueSet  "nameExisting", {?IfNotEmptyThen {&Attributes.Name (English)}, "x"}{?ValueGet "nameExisting"}}

                         

                         

                        This is my main module content:

                         

                         

                        {&Item.Item no.}{!re-init for every item}{?ValueSet "nameMissing", ""}{?ValueSet "nameExisting", ""}{$Attributes}

                         

                          missing names: {?ValueGet "nameMissing"}

                         

                          existing names: {?ValueGet "nameExisting"}

                         

                          -> only missing names: {!nameMissing is not empty, nameExisting is empty}{?IfNotEmptyThen {?ValueGet "nameMissing"}, {?IfEmptyThen {?ValueGet "nameExisting"}, YES}}

                         

                          -> only existing names:{!nameMissing is empty, nameExisting is not empty}{?IfEmptyThen {?ValueGet "nameMissing"}, {?IfNotEmptyThen {?ValueGet "nameExisting"}, YES}}

                         

                         

                         

                        I hope this will help you.

                         

                         

                        Sabine.

                        1 of 1 people found this helpful
                        • 9. Re: Finding Items with or without Attributes
                          Vaishali Ahlawat Guru

                          Hi dwalter

                           

                          Thanks it cleared a lot, not sure how I checked but I somehow missed that now fields in query does not have to be mandatorily qualified and it helps with the problem now, I do have the new approach and only thing left is to figure out if item has both kind of attributes (external and structure feature groups assigned) then in query if I say value is empty and it has empty and non empty values both then it does not give me items only having "no value"

                          but both .

                           

                          About,

                          CheckMandatoryValues

                                - this checks if the attribute has a value, if the structure group feature is mandatory. This is a checkbox on the future group list.

                          I have this in structure feature group and mandatory is ticked and still if I run this rule , it says ok even though there is no values associated with these attributes (neither in feature group values nor in item attribute values) .

                          Any idea on this ?

                           

                           

                          Thanks,

                          Vaishali

                          • 10. Re: Finding Items with or without Attributes
                            Vaishali Ahlawat Guru

                            Hi SBeutler ,

                             

                            I do need export at the end because I have to group the data based on other field and give a report but I do need query as well as I can use an assortment and then can use in export and your idea above is really what I need and I tried as well but as you mentioned again "If an item has attributes with names and attributes without names, we are not able to classify that item as good or bad".

                             

                            I missed somehow that in queries field does not have to be classified now but I am again just stuck on items with both kind of attributes thing even with query as I mentioned above in my reply to Daniel

                            in query if I say value is empty and it has empty and non empty values both then it does not give me items only having "no value" and this I need to give the items having no values at all .

                             

                            I will talk about this to client, meanwhile if something clicks to you still , the suggestion would be so helpful for me to have an attempt on it .

                             

                            Thanks,

                            Vaishali

                            • 11. Re: Finding Items with or without Attributes
                              Vaishali Ahlawat Guru

                              Hi SBeutler

                               

                              Your way of export works , being new to PIM I was not really sure on this way of writing export functions.It was a real big help .

                               

                              I added another statement for finding items with & without names both:

                               

                              {!nameMissing is not empty, nameExisting is not empty}{?IfNotEmptyThen {?ValueGet "nameMissing"},{?IfNotEmptyThen {?ValueGet "nameExisting"},BothAttributes}}

                               

                              It gives me all required data:

                               

                              1) Items with Names

                               

                              2) Items with blank names

                               

                              3) Items with & without names.

                               

                              I am working in getting it finalized but I was excited to let you know that it worked and how grateful I am for the help.

                               

                              Thanks,

                               

                              Vaishali