Announcement

Collapse
No announcement yet.

How to make numbers match, ignoring delimiters?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make numbers match, ignoring delimiters?

    How would I set up a text rule which matched numbers (i.e. multi-digit) when they were the same in both files, and ignored tab/comma differences between the files?

    More generally, can someone point me to a description of how to define text comparison grammars? I don't understand the role of the pre-existing element names. For example when I select "Number" as an element, I cannot click OK until I also fill something in under "Text matching", which makes it seem as if the name "Number" is arbitrary. However I get a different result if I give an element an arbitrary name than if I select the existing name "Number", even when the "Text matching" field is the same for both.

    Thanks.

  • #2
    If you are wanting to compare a comma-separated-values file with a tab-separated-values file in a data compare, a simple solution would be:
    1. Tools \ File Formats
    2. Right-click on "Comma Separated Values" file format
    3. Save As "Tab Separated Values"
    4. Click on the new "Tab Separated Values" format
    5. Move it down in the list under "Comma Separated Values"
    6. Click the "Type" tab
    7. Uncheck "Comma" and check "Tab" in the Delimiter settings

    When you compare two .csv files (one delimited by commas and one delimited by tabs) both files will auto-detect as Comma Separated Values in the data compare. You will see a format dropdown in the file details (between the filename dropdown and the data pane). For the side that contains tab delimiters, simpy set the format to "Tab Delimited File", and the data compare will correctly delimit each side.

    (note: if you don't want a new file format, you can simply activate Tabs as delimeters in the original .csv file format... but depending on your use, this could mess things up in a tab delimited file that has numeric data containing commas in the thousands position, etc.)

    If you are wanting to compare the files in a text compare, then you will need to set up text replacements or grammar rules to handle it (a more complex solution).
    BC v4.0.7 build 19761
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

    Comment


    • #3
      And as Erik mentioned here, a better solution might be to configure the .csv file format to detect it's own delimeters.
      BC v4.0.7 build 19761
      ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ

      Comment


      • #4
        Many thanks, Michael. Your reply and Erik's solved my immediate problem (looking in session settings instead of general options.)

        Long term, I'd still like to see a description of how to set up grammar specifications for text files.

        Comment


        • #5
          This is something that will documented more as the specifications are settling down. We'll probably have a video on the website as well.
          Aaron P Scooter Software

          Comment


          • #6
            JD. I setup two files with different formats for multi-digit numbers...one with commas one without and had no problem matching the lines when the only diffs were the number of tabs, spaces or commas.

            Under the Session settings, I unchecked all the whitespace options.
            Under File Formats I created a entry to match *.txt with one "grammar" rule: string, regular expression = ,.

            Assuming this doesn't work for you, can you post or attach an example of the lines you want to compare?

            Comment


            • #7
              Many thanks, Maurice. Now that I've been directed to the File Formats dialog (yeah, shouldn't have been hard to find... duh) I think I'm set for the moment.

              Comment

              Working...
              X