4 Replies Latest reply on Sep 15, 2020 2:32 AM by Roxana Dragnea

    Export - validation rules on structure assignment transition field

    Roxana Dragnea New Member

      Hello,

       

      We need to restrict the data source for some exports to export only the variants assigned to a structure that allows many assignments (Region assignments).

      The assignment is at the variant level and the values in the Structure assignment field look like "01; 02; 04" when I export the field. I need to apply a data validation rule that this field must contain 02, otherwise, the record should be removed.

       

      I have tried to use the rule "Must contain" with all of the available modes (Exact, Placeholder, Regular expression) and have also validated online the regular expression, but when I try to specify that the field must contain 02, the record is removed even though 02 is part of that string. I would have expected to have it work also with Simple Placeholder and something like *02*, but it removed the record even though the variant was assigned to '02'.

       

      The most complex configuration used was with regular expression was: ^(0-9)*[^\']*(02)(0-9)*[^\']*$.

       

       

      What is strange is that the same field can be used in the search functionality for getting only the variants assigned to a specific structure:

       

       

      I have to mention that we cannot use the assortments as the data source is built based on the variants assigned to an assortment and that assortment is the data source New or Changed products (as this export is built for delta product changes and we are using the 3 tier configuration Product, variant and item). Neither using a condition directly in the export message would not work as I need to print the header for the dataset counter = 1 and in some cases may be that the first record is not assigned to region 02 and then, no header is printed.

       

      Can anyone help with the correct configuration for the "must contain" validation in order to keep only the variants assigned to a specific structure? Also, any other idea will be highly appreciated.

       

      Thank you!

        • 1. Re: Export - validation rules on structure assignment transition field
          Sai Narasimha Prasad Rebba Guru

          Hi Roxana,

           

          I understand that you are trying export item/product/variant which are assigned to a particular structure group.

           

          There s a data source "All_groups_in_Structure_System(with_item_filter)" which has sub-entity type as item/product/variant, by using it you can export the items and you can also try with the "Structure Group list" data source.

           

          I attached the sample export format template for you which I have tried.

           

          Thank you
          Sai Prasad

          • 2. Re: Export - validation rules on structure assignment transition field
            Roxana Dragnea New Member

            Hi Sai Prasad,

             

            Thank you for your response.

             

            The configuration you have made would indeed work, but here we come to the other issue I am trying to solve by filtering directly the data source.

            This is also the current downside of my current setup. I am trying to print also the header only for the first row from the dataset and if I am using the compare function, if the first row is not assigned to that specific value from the structure group, it will not print the header.

            On the other side, if I am using it outside the compare function in order to print the header only for dataset Id =1, then if there is no record assigned to that specific structure value it will anyway print the header and I will have in the file only the header. This will cause other issues as now I am removing the empty files in the post export processing steps by checking the file size.

             

            There are also other developments done that would require to filter directly the data source without using the compare function in the template. For the time being in order to overcome this issue, I am printing the header for all the records and afterward, I am running a post export step for removing the duplicated rows, but the files are becoming very big as I am printing the header for each record from the data source which in some cases can reach hundred thousands of records.

             

            If you have any other ideas on how I could print the header only once if there is at least one record assigned to that structure group value, that would also help.

             

            Thanks,

            Roxana

            • 3. Re: Export - validation rules on structure assignment transition field
              Sai Narasimha Prasad Rebba Guru

              Hello Roxana,

               

              try with the attached export format template and see if that works for you.

               

              Thank you

              Sai Prasad

              • 4. Re: Export - validation rules on structure assignment transition field
                Roxana Dragnea New Member

                Hi Sai Prasad,

                 

                I have tried to add the header inside the compare function, but in that case, the header will be printed as many times as items in the data source, and the file can become very large making the post export processing step for removing the duplicate rows to take too long.

                 

                Therefore, I have tried to use the function DataCounter and print the header only for the first row, but in that case, I am getting an issue in the case the first record is not printed as neither the header will not be printed.

                 

                {?Compare "datatest", {&Structure group.Structure group identifier},{?Compare {?DatasetCounter},1,{$Header}{$sub},{$sub}},}

                 

                On the other hand, if I am using something as the below function, then it will print the header even though there is no data printed in the file (in case the dataset contains only items assigned to another structure group then the needed one).

                 

                {?Compare {?DatasetCounter},1,{$Header} {?Compare "datatest", {&Structure group.Structure group identifier},{$sub},}

                 

                That's why I think the only option would be to filter the data source in order to get only the requested data.

                 

                Thanks,

                Roxana