Variable Data Alignment

Variable Data Alignment

3
NewbieNewbie
3

    Aug 29, 2006#1

    If I had data such as

    Barrington60060StCroix50505Wellington60103WestChicago43892

    looking for Barrington 60060
    St.Croix...

    I am trying to compose a Macro to break down data that is not consistent. I am struggling. I cant find median data to "define" to break it apart, such as a common keyword. Is there any way to define a macro such as find "6***6" or to specify a particular column to move with a macro.



    Also is it possible to compose a macro to move data from say column 135 to column 155, I cannot find any help on subjects of these matters...

    6,675585
    Grand MasterGrand Master
    6,675585

      Sep 06, 2006#2

      Can you give us an example of a few lines before and after macro execution, if needed enclosed in to see also white-spaces correctly (use preview)?
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        Sep 06, 2006#3

        Illinois Anesthesia 8-22-06 Account Number 0000000 Total Charges 1600.00 Name James Jameson Address 2222 West Lake St Chicago IL =======Illinois Anesthesia 8-22-06 Account Number 0000000 Total Charges 0.00 Name Ryan James Address 1111 North Lake Street Lincolnwood IL =======Illinois Anesthesia 8-22-06 Account Number 0000000 Total Charges 160,000.50 Name Ahmir Azmeth Rynelds 2222 North Bay Avenue Bannockburn IL

        This is a small fragment of the data, now I can write macros to break it down with the tab function (^t) but it is not consistent. If the charges vary or the name is longer the tab extends it such as

        Code: Select all

        Illinois Anesthesia 8-22-06 Act #0000000 Total Charges 160,000.50
        Illinois Anesthesia 8-22-06 Act #0000000      Total Charges      0.00
        and so forth and so on most of the data does not align correctly with different variable (ie: longer name, longer charges, longer address)

        I want everything to be a consistent field with no having to manually massage the fields that do not tab the data perfectly with one another. Its a struggle, any help would be greatly appreciated!

        Adam

        6,675585
        Grand MasterGrand Master
        6,675585

          Sep 08, 2006#4

          With this still little information I started to write the macro. It reformats the data and creates a tab separated value file. The date string will be already perfect reformated (hopefully) by inserting leading zeros where necessary. The macro property Continue if a Find with Replace not found must be checked for this macro.

          InsertMode
          ColumnModeOff
          HexOff
          UnixReOff
          Bottom
          IfColNum 1
          Else
          "
          "
          EndIf
          Top
          Find "======="
          Replace All "^p"
          Find RegExp " ^([0-9]-[0-3][0-9]-[0-9][0-9] Account Number^)"
          Replace All " 0^1"
          Find RegExp " ^([0-9]-^)^([0-9]-[0-9][0-9] Account Number^)"
          Replace All " 0^10^2"
          Find RegExp " ^([01][0-9]-^)^([0-9]-[0-9][0-9] Account Number^)"
          Replace All " ^10^2"
          Find RegExp "%^(*^) ^([01][0-9]-[0-3][0-9]-[0-9][0-9]^) +Account Number ^([0-9]+^) +Total Charges +^([0-9.,]+^) +Name^(*^) Address"
          Replace All "^1^t^2^tAct #^3^tTotal Charges^t^4^tName^5^tAddress"
          Find RegExp " ++^t+"
          Replace All "^t"

          The next step would be to do what you can do manually with Column - Convert to Fixed Column with the macro. The problem is, I don't know the maximum width of all the information columns. The date and the account number column width is clear, but what is the maximum width of the other columns?

          There is no macro command for Convert to Fixed Column. So the macro must replace each tab with an in every case sufficient number of spaces depending on the maximum width of every information column. Because this would still result in an eroded line layout, each column (information column, not character column) must be selected and left or right aligned in colum mode as it can be done also manually with Column - Left or Right Justify.

          The last step of the macro would be to delete all columns which contain only spaces except the information columns separating blank columns.

          I have this already done once as you can see in the hopefully well commented macro for the Word Frequency Counter.

          Maybe with these additional infos you can complete the work on the macro itself. If not, tell me the number of information columns, the maximum width of each information column and how each column should be aligned and I will try to complete the macro. A more useful example would help too.

          Note: The 3rd information line does not contain the in my point of view (and for the macro) important keyword Address. Is this by mistake or are there really data lines in your file without the Address keyword.
          Best regards from an UC/UE/UES for Windows user from Austria