Jump to content
Macro Express Forums

Set Variable Based On Length Of String


cyberchief

Recommended Posts

Ok... this may get confusing... I have the solution on the tip of my brain but I am hitting a roadblock. I think it can be done... I just can't seem to be able to put 2 and 2 together. Here it is.

 

I have a variable string that can be quite long. I need to break it into multiple variables in character groups of 36.

 

Variable Set String %T11% "Adj MRC & NRC billed in error when QLBVPP applied to 156 accts. total adj all accts $32594.62 aprvd Qcare adj ID #22370. content id #10153. Qwest accept date 1/20/05.""
Variable Set Integer %N1% from Length of Variable %T11%
Variable Modify Integer: %N1% = %N1% / 36

 

I use the /36 to decide how many lines are going to be needed... the line above would create 5 lines (See below)... and my repeat would have to be set.

 

I need to use that string to put a note in the system. Here is how it would look (36 character limit per line):

 

Adj MRC & NRC billed in error when Q

LBVPP applied to 156 accts. total ad

j all accts $32594.62 aprvd Qcare ad

j ID #22370. content id #10153. Qwes

t accept date 1/20/05.

 

 

Now, it is easy enough to use commands to copy and delete part of %T11%. But what I need to do is to enter line 5 FIRST. With each note put in, the next line goes on TOP of the one just entered... hence the reason I need to put line 5 in first. After line 5, I need to put in line 4, and so on. Although I only have 5 lines on this note, that won't always be the case. The length of variable %T11% can change with different projects. So I am trying to use a variable interger to designate the current line being put in. I know there is a way to do this using %T%N1%%... but I just can't figure it out. The logic is just escaping me. I am going to keep working on this... but if anyone has any suggestions... I would appreciate it. Thanks!

Link to comment
Share on other sites

Hello cyberchief!

 

The order in which you need to place the parsed sample string is:

 

1) t accept date 1/20/05.

2) j ID #22370. content id #10153. Qwes

3) j all accts $32594.62 aprvd Qcare ad

4) LBVPP applied to 156 accts. total ad

5) Adj MRC & NRC billed in error when Q

 

Do I understand correctly?

Link to comment
Share on other sites

Hello cyberchief!

 

The order in which you need to place the parsed sample string is:

 

1) t accept date 1/20/05.

2) j ID #22370. content id #10153. Qwes

3) j all accts $32594.62 aprvd Qcare ad

4) LBVPP applied to 156 accts. total ad

5) Adj MRC & NRC billed in error when Q

 

Do I understand correctly?

That is correct, Joe. I need the last line first and the first line last. They will be entered into a program... It almost like writing a letter... but having to start from the bottom line and work your way up.

Link to comment
Share on other sites

This will do the job:

Variable Set String %T2% "-"
Variable Set String %T11% "Adj MRC & NRC billed in error when QLBVPP applied to 156 accts. total adj all accts $32594.62 aprvd Qcare adj ID #22370. content id #10153. Qwest accept date 1/20/05."
Repeat Until %N1% <= 36
 Variable Modify String: Copy Part of %T11% to %T1%
 Replace "%T2%" with "%T1%%T2%" in %T2%
 Variable Modify String: Delete Part of %T11%
 Variable Set Integer %N1% from Length of Variable %T11%
Repeat End

Text Type: %T11%<ENTER>
Repeat Until %N1% = 1
 Variable Modify String: Copy Part of %T2% to %T1%
 Text Type: %T1%<ENTER>
 Variable Modify String: Delete Part of %T2%
 Variable Set Integer %N1% from Length of Variable %T2%
Repeat End

--------------------
<TVAR2:02:01:-><TVAR2:11:01:Adj MRC & NRC billed in error when QLBVPP applied to 156 accts. total adj all accts $32594.62 aprvd Qcare adj ID #22370. content id #10153. Qwest accept date 1/20/05.><REP3:08:000006:000002:0001:0:01:36><TMVAR2:10:01:11:001:036:><TMVAR2:21:02:00:000:000:%T2%%T1%%T2%><TMVAR2:11:11:00:001:036:><IVAR2:01:12:11><ENDREP><REM2:><TEXTTYPE:%T11%<ENTER>><REP3:08:000001:000002:0001:0:01:1><TMVAR2:10:01:02:001:036:><TEXTTYPE:%T1%<ENTER>><TMVAR2:11:02:00:001:036:><IVAR2:01:12:2><ENDREP>

The first loop rebuilds the string 36 characters at a time and leaves the remainder as is. The second loop types the reversed string beginning with the leftover portion. I did not test it with a string <= 36 characters long.

 

As to the avatars ... thanks. English Bulldogs are a wonderful breed.

Link to comment
Share on other sites

Joe,

 

For some reason, after I put it in... it keeps cutting off the last line. I had to change some of the variable numbers... but as far as I can tell, that shouldn't have affected the way it runs. Can you look below and see what I am missing? I notice that you run the text type 1 time before setting the loop... so I did that on mine as well.

 

Variable Set String %T21% "-"
Repeat Until %N1% <= 36
 Variable Modify String: Copy Part of %T11% to %T20%
 Replace "%T21%" with "%T20%%T21%" in %T21%
 Variable Modify String: Delete Part of %T11%
 Variable Set Integer %N1% from Length of Variable %T11%
Repeat End

Text Type: <TAB>
Delay 0.2 Seconds
Text Type: <TAB>
Delay 0.2 Seconds
Text Type: %T13%
Delay 0.2 Seconds
Text Type: <TAB>
Delay 0.2 Seconds
Text Type: %T20%
Delay 0.2 Seconds
Text Type: <TAB><TAB>
Delay 0.2 Seconds
Text Type: %T12%
Delay 0.2 Seconds
Text Type: <NUMENTER>
Delay 0.2 Seconds

Repeat Until %N1% = 1
 Variable Modify String: Copy Part of %T21% to %T20%
 Text Type: <TAB>
 Delay 0.2 Seconds
 Text Type: <TAB>
 Delay 0.2 Seconds
 Text Type: %T13%
 Delay 0.2 Seconds
 Text Type: <TAB>
 Delay 0.2 Seconds
 Text Type: %T20%
 Delay 0.2 Seconds
 Text Type: <TAB><TAB>
 Delay 0.2 Seconds
 Text Type: %T12%
 Delay 0.2 Seconds
 Text Type: <NUMENTER>
 Delay 0.2 Seconds
 Variable Modify String: Delete Part of %T21%
 Variable Set Integer %N1% from Length of Variable %T21%
Repeat End

 

<TVAR2:21:01:-><REP3:08:000006:000002:0001:0:01:36><TMVAR2:10:20:11:001:036:><TMVAR2:21:21:00:000:000:%T21%%T20%%T21%><TMVAR2:11:11:00:001:036:><IVAR2:01:12:11><ENDREP><REM2:><TEXTTYPE:<TAB>><DELAY:.2><TEXTTYPE:<TAB>><DELAY:.2><TEXTTYPE:%T13%><DELAY:.2><TEXTTYPE:<TAB>><DELAY:.2><TEXTTYPE:%T20%><DELAY:.2><TEXTTYPE:<TAB><TAB>><DELAY:.2><TEXTTYPE:%T12%><DELAY:.2><TEXTTYPE:<NUMENTER>><DELAY:.2><REM2:><REP3:08:000001:000002:0001:0:01:1><TMVAR2:10:20:21:001:036:><TEXTTYPE:<TAB>><DELAY:.2><TEXTTYPE:<TAB>><DELAY:.2><TEXTTYPE:%T13%><DELAY:.2><TEXTTYPE:<TAB>><DELAY:.2><TEXTTYPE:%T20%><DELAY:.2><TEXTTYPE:<TAB><TAB>><DELAY:.2><TEXTTYPE:%T12%><DELAY:.2><TEXTTYPE:<NUMENTER>><DELAY:.2><TMVAR2:11:21:00:001:036:><IVAR2:01:12:21><ENDREP>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...