Quattro Pro X7 - String functions keep bugging me - Tips & Tricks - WordPerfect Office - OfficeCommunity.com

Quattro Pro X7 - String functions keep bugging me

I have spend hours trying every function that I thought migt do the trick, but I failed. SO some help would be appreciated.

Here is my problem


The contents of a cell (D4) are 743D0BD5

What I need is to distribute this entry over 4 columns, 2 characters in each column.

Text Reformat does not get me that result, although I am following the instructions step by step

Using @MID, @LEFT and @RIGHT I am using instructions like this @LEFT(D4, 1, 2), which should give me (but that is a thought based upon what I remember from using BASIC) either the first and second or the second and third character of the string in D$. But all I get is 'not enough arguments'.

The HELP files have all kinds of examples, but all of those are built around finding a result, like a name or a date. Once I get this working I need to do the same thing with 500+ lines with random content, so programming Quattro line by line is undoable. I just need - in this case 4 results: 74 3D 0B and D5

@ISSTRING returns 1, which I understand means that the string in D4 is OK.

So if anyone could tell me ehat I am doing wrong, thank you in advance.

13 Replies

  • @left(D4,2) or @mid(D4,0,2)
    @mid(D4,2,2)
    @mid(D4,4,2)
    @right(D4,2) or @mid(D4,6,2)
    The 2nd argument of mid is the start position which starts at zero
  • In reply to tlnett:

    Thanks for the effort. Didn't work. Tried them all. All resulted in Not enough arguments.

  • In reply to dlagewaa:

    Don't know what to tell you. It worked for me. And the example in your first post, @LEFT(D4, 1, 2), resulted in "too many arguments". the left and right functions need 2 arguments and mid needs 3.

    Maybe Charlie will pop in with an answer for you. He's the QP guru.
  • In reply to dlagewaa:

    I think I see the problem.  Don't use the Format > Text reformat.   I'm not sure how that works.   Just put the appropriate function listed above in where you want each 2 character string.

  • Did you ever get this working. I'm guessing that maybe you are trying to separate MAC addresses into their respective octets. Should be very doable in QuattroPro.
  • In reply to dlagewaa:

    I made a sample file to test.  I will try to attach it here. I guess no dice for attaching.  I will paste the formula view below the sample output.   The first couple of columns just generate random data.  The 4th column combines the first two into an 8 character Hex string.  The 6th thru 9th column contain the parsed string in hex octets.   Looks like below, but with better alignment:

    I started at row D to match your original inquiry.

    First 2 columns contain  @RANDBETWEEN(4096,65535)
     
    4th column contains @CONCATENATE((@NUMTOHEX(B4)),(@NUMTOHEX(A4)))
     
    following columns contain  @LEFT(D4,2)    @MID(D4,2,2)    @MID(D4,4,2)    @MID(D4,6,2)    --  could have use @RIGHT as well

      @LEFT(E4,2)    @MID(E4,2,2)    @MID(E4,4,2)    @MID(E4,6,2)   etc.


    These columns are easily copied down where the row letter automajically increments (basic spreadsheet functionalilty)

    This output does not have the random numbers that were used to create the 8 char string but hopefully gives what you are looking for.

    C6977542        C6    97    75    42
    9AC297B1        9A    C2    97    B1
    2361C67D        23    61    C6    7D
    3FB777C0        3F    B7    77    C0
    D935ADE4        D9    35    AD    E4
    CD6AA5A9        CD    6A    A5    A9
    30F7BDC7        30    F7    BD    C7
    B83A4112        B8    3A    41    12
    86B6C6E9        86    B6    C6    E9
    C63762E2        C6    37    62    E2
    E655CCE1        E6    55    CC    E1
    D2838B6C        D2    83    8B    6C
    F61311F2        F6    13    11    F2
    986C98C3        98    6C    98    C3

  • In reply to tlnett:

    Hello Tim,

    Could you do me afvour and mail your sample file to:

    Thank you.

  • In reply to dlagewaa:

    dlagewaa
    Hello Tim,

    Could you do me afvour and mail your sample file to:
    Thank you.

    Done.  It will be coming from a sneakemail address so make sure that is not blocked.

    You may want to delete your email from this forum as spam bots sometimes harvest addresses from forums.

  • In reply to tlnett:

    Hello Tim,

    So it was indeed a syntax error. Replacing colons with semi-colons did the trick.

    Thank tou very much for your assistance.

    David L.
  • In reply to tlnett:

    I just saw this thread and have a few comments.

    1) As far as I can tell, Text Reformat doesn't do anything. But the help file suggests that it redistributes text in one set of cells to another. I was unable to get it to do even that.

    2) The closest built-in function to the one desired is the QuickColumns function, but it does not appear to allow the user to break a text into 2-character columns.

    3) The functions that Tim identifies should not yield a "Not enough arguments" error message, as the help file will confirm. Searching the WordPerfect Universe site, that error message most commonly occurs when the function is not perfectly formed, as where there is an extra space somewhere, or a missing parenthesis.

    4) I wrote a little macro that works in my testing. Place the cursor on the topmost text entry to be split into the four columns to the right, and then run (alt+f2) this macro.

    {if []c(0)r(0)=""}{quit}
    {let []c(1)r(0),@mid([]c(0)r(0),0,2)}
    {let []c(2)r(0),@mid([]c(0)r(0),2,2)}
    {let []c(3)r(0),@mid([]c(0)r(0),4,2)}
    {let []c(4)r(0),@mid([]c(0)r(0),6,2)}
    {d}{branch c(0)r(-5)}

    The macro moves down the column of text entries, looping until it reaches a blank cell. At each stage, it uses the @MID function to place the desired two characters into the four columns to the right of that cell.

    Charlie
  • In reply to Charles Cork:

    Hi Charlie,

    I was wondering when you were going to jump in and pull us out of the ditch. I sent my sample file to the OP. He opened it and noticed that all the delimiters were semicolons. They were commas when I sent it. He had been using commas as that is what Help said. I think he is in The Netherlands. In any case, I changed an international setting for punctuation, where a space is the thousands separator, a comma is the decimal point, and a semicolon is the delimiter and opened the file. The delimiters in the file were now semicolons. I changed one to a comma and got a "Not enough arguments" error. Not sure of the OP's settings, but am sure this led to his problem.

    Just passing this on so you can add it to your bag of tricks. Thanks.
  • In reply to tlnett:

    Thanks, Tim. Your diagnosis looks entirely plausible. If semicolons are the default delimiter, commas are probably treated as text or as numeric divisors rather as delimiters.