Community
    • Login

    select products with a certain category (tag)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 724 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • massimo la terraM Offline
      massimo la terra
      last edited by

      I have an xml file with many products selected by category and subcategory, how can I view only the subcategory I prefer? example subcategory "salumeria"Cattura.JPG

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @massimo la terra
        last edited by

        @massimo-la-terra ,

        It depends on what you want. In one instance, you say “view”, in another, you say “select”, and those are two different things.

        For “view”, take for instance the following simplified data:

        <parent>
        <Product>
            <id>11111</id>
            <code>22222</code>
            <Subcategory>CORPO</Subcategory>
        </Product>
        <Product>
            <id>333</id>
            <code>4444</code>
            <Subcategory>SALUMERIA</Subcategory>
        </Product>
        </parent>
        

        If I do View > Fold All (Alt+0), it will collapse it down to only showing the parent: fd5738fc-fbf1-4d5d-b07a-da722d8ff367-image.png

        At this point, if I search for SALUMERIA, it will just uncollapse the segment necessary to show the line containing SALUMERIA:
        8e4e463a-9c76-49ad-bc1b-ca4e76a91f3f-image.png

        (sorry, my screenshots above were taken when I had all lowercase for the tags; I uppercased them after I realized it would affect the regex below)

        -----

        On the other hand, if you want to select the whole <Product>...</Product> which contains <Subcategory>SALUMERIA</Subcategory>, then a search similar to Find what = (?s)<Product>(?:(?!</Product>).)*?<Subcategory>SALUMERIA</Subcategory>(?:(?!</Product>).)*?</Product>\R? with Search Mode = Regular Expression should be used.

        18cb03ab-8c8d-4a80-8ad3-d9bd9cce0096-image.png

        1 Reply Last reply Reply Quote 1
        • massimo la terraM Offline
          massimo la terra
          last edited by

          thanks for the answer, sorry for my translated English, in practice with a click I would like to display only the products of the Subcategory> SALUMERIA </Subcategory>Immagine 2022-06-15 165046.png

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP Online
            PeterJones @massimo la terra
            last edited by PeterJones

            @massimo-la-terra said in select products with a certain category (tag):

            thanks for the answer, sorry for my translated English, in practice with a click I would like to display only the products of the Subcategory> SALUMERIA </Subcategory>

            Notepad++ is an editor, not an XML Presentation filter, so it will never give you exactly that. Its job is to make it easy to edit the raw text as a whole, not easy to just see filter the sub-categories you want

            My first set of instructions will allow you to hide everything, and then you just do the search (as described above) to find the next occurrence of that; after you’ve cycled through enough “Find Next”, you will have shown all the product groups with the subcategory SALUMERIA. Problem solved.

            For example,

            1. start with
            <Product>
            	<irrelvant>...</irrelvant>
            	<Subcategory>SALUMERIA</Subcategory>
            	<irrelvant>...</irrelvant>
            </Product>
            <Product>
            	<irrelvant>...</irrelvant>
            	<Subcategory>OTHER</Subcategory>
            	<irrelvant>...</irrelvant>
            </Product>
            <Product>
            	<irrelvant>...</irrelvant>
            	<Subcategory>SALUMERIA</Subcategory>
            	<irrelvant>...</irrelvant>
            </Product>
            <Product>
            	<irrelvant>...</irrelvant>
            	<Subcategory>OTHER</Subcategory>
            	<irrelvant>...</irrelvant>
            </Product>
            

            So there are two products in the SALUMERIA subcategory, and two that aren’t.
            2. Hit Alt+0 to hide everything
            5e748307-197b-4df7-9b0c-02556eafd883-image.png
            3. FIND = <Subcategory>SALUMERIA</Subcategory>
            86d57c15-5f0a-42bc-b00b-2cc2dc9e50a1-image.png
            4. FIND NEXT will show the second one as well:
            31a7eb58-9bbd-403a-89b5-8be4b4b45ed4-image.png
            5. Repeat FIND NEXT until they have all been revealed.

            It’s not a single click, but it doesn’t take all that long.

            1 Reply Last reply Reply Quote 2

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors