Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate Strings Problem

Status
Not open for further replies.

MrTrue

Technical User
Jul 28, 2008
46
US
Hello Everyone,
This is my first attempt to post to a forum, so I apologize if I miss anything.

I have a problem with a macro I'm trying to create in Attachmate Extra Sessions.

The macro is used to pass between different screens in the session, pull data strings, format those strings and finally it goes to another screen where it inputs those strings.

My new macro concept is set to do several things. First I pull about 25 different pieces of information from the screens.

For example, I pull a Date of service using...
DOS = sesso.screen.getstring (1,2,6)
DOS = Format(DOS, "mm/dd/yyyy")

The final input screen has up to 10 different fields that need filled out with any different combination of my current strings.

I decided to create template files in .dat format so that the user gets prompted with an inputbox and they type in a number, the macro checks the system folder to see if a file by that number exists and returns 10 variables that are in the .dat file which I pulled out using an array.

Example-
"Namefile= "S:\Dental Claims DeptAccess\Team Macros\Toolbar Files\DataTrack\" & LetterNum & ".dat"
Open Namefile for Input As #1
Input #1, Var(1), Var(2), Var(3), Var(4), Var(5), Var(6), Var(7), Var(8), Var(9), Var(10)
Close #1 "

Here's the problem,
If Var(1) = DOS in the .dat file, I want it to return the value of the string DOS, not the text "DOS".

The .dat file is formated in this manner
"DOS","MRD","3","4",etc...
If the Var() in the .dat file has a matching string in the macro I want it to return the strings defined value, if there is no match, I want it to return the actual text value("DOS"). Is there an easy way to do this? I don't really want to write a ton of "If...Then" statements. I'm fairly new to this and I can't figure this out. I appreciate any insight you may be able to provide me. Thanks again!


JT
 



Hi,

First off...
Code:
DOS = sesso.screen.getstring(1,2,6)
returns a STRING. The Format function works on NUMBERS, formatting them into STRINGS. So is your DOS string date format is mmddyy, then the next statement should be...
Code:
DOS = Mid(DOS,1,2) & "/" & Mid(DOS,3,2) & "/" & Mid(DOS,5,2)
"I want to return the value of the string DOS not the text 'DOS'"
Code:
select case Var(i)
  case "DOS'
    x = DOS
  case "MRD"
    x = ???
  case "3"
    x = ??????
'...etc
select
You never said, returned to WHAT.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thank you for the feedback! I apologize for not posting more complete code, I did actually have the DOS defined as you did above...

Code:
DOS = Mid(DOS,1,2) & "/" & Mid(DOS,3,2) & "/" & Mid(DOS,5,2)

I did as you suggested and used "select case" built it into a "do loop" and it worked perfectly.
Code:
Dim i as Integer                
    
    i=1
    
  Do Until i = 10
    
    select case Var(i)
  
  case "Member"
    Var(i) = Member
  case "Patient"
    Var(i) = Patient
  case "DOS"
    Var(i) = DOS
  case "MRD"
    Var(i) = MRD
  case "TIN"
    Var(i) = TIN
  case "TRL"
    Var(i) = TRL
  case "semester"
    Var(i) = semester
  case "nextsemester"
    Var(i) = nextsemester
  case "Pcity"
    Var(i) = Pcity
  case "Pstate"
    Var(i) = Pstate
  case "Pzip"
    Var(i) = Pzip
  case "Paddress"
    Var(i) = Paddress 
  case "Paddresstwo"
    Var(i) = Paddresstwo
  case "Pfirst"
    Var(i) = Pfirst
  case "Plast"
    Var(i) = Plast
  case "Ptitle"
    Var(i) = Ptitle
  case "Provider"
    Var(i) = Provider
  case "followup"
    Var(i) = followup
  case "cenumber"
    Var(i) = cenumber
  End select
  
    i=i+1
  Loop

Is there anything wrong with using a loop around the select case? If not I'll keep it as is. Again thanks so much for your feedback, I'm not sure how long it would have taken me to figure it out without your help! :)
 



"Is there anything wrong with using a loop around the select case?"

Knock yourself out!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top