Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using field values to format SQL output
Message
From
26/08/2008 19:11:03
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Using field values to format SQL output
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01342035
Message ID:
01342035
Views:
60
I have these fields in a table. These can be changed if someone has a better way to handle it. I am using values like 9N in the SSN field to mean that during processing, for this carrier, the result of the SSN should be numeric and have a length of 9. For the LastName, it can be alphanumeric and have a length of 35. The dates are just as obvious. For one like MemberID, it starts with a "W" and is followed by 9 numeric values.

I'm currently heading down a path where I have a SQL statement that calls a function for each field. In the function I evaluate that field's formatting value that is in this table. Based on that, it runs through some CASE statements and the value is formatted and returned in the SQL result for that field.

The issue is how to code to parse apart the format values below and then handle all the possibilities. Should I parse apart the values I have so that I know that 9N means a numeric value with a length of 9, and do the same with the other fields? That seems like a lot of detailed parsing, and I wonder if it is necessary. The dates are easy, but some of the others are not.

Any ideas?
FieldName     Example of possible value

PAYORID       ZZCERT     
PAYORNAME     O/P MOLINA HEALTHCARE MICHIGAN
NPI           10N        
SSN           9N                                                   
MEDICARE      10AN                                                           
MEDICAID      
MEMBERID      W+9N
PROVIDERID    5A
FEDTAXID      9N
DOB           CCYYMMDD   
LASTNAME      35AN         
FIRSTNAME     25AN         
SUFFIX        3AN         
TRANSDATE     MMDDCCYY
DOSBEGIN      CCYYMMDD   
DOSEND        CCYYMMDD   
GENDER        1A                                   
CARDNUMBER    15AN
Next
Reply
Map
View

Click here to load this message in the networking platform