Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using field values to format SQL output
Message
 
 
To
27/08/2008 13:30:22
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01342035
Message ID:
01342267
Views:
14
Testing for the particular mask can be done either with Regular Expressions RegEx (in this case Gregory is the expert :) or with testing the field against the mask. I have another thread on this one here as well, give me another second.

Hopefully someone else will chime in too, because otherwise I would never figure out the problem with the remote server.

>Ok, so I have something working in that I can identify the output field type and value. I have conditions that will also be based on what the field itself is, like SSN. How can I best evaluate the value being sent fits the rules after the TRANFORM? I think I can make the transform more generic by using REPLICATE with "9" and the FieldLength, but after that I need to use the FieldType, in this case it is N, to determine if it should be allowed. I can use LEN to make sure they are not under/over the requirements. I know I can use ISDIGIT to identify numeric, but ISALPHA only works on the first character and what about alphanumeric? If you're getting tired of all this, maybe someone else can step in.
>
>
>FieldValue = '999-99-9999'
>FormatValue = '9N'
>FieldLength = VAL(CHRTRAN(FormatFieldValue, FormatValue,''))
>FieldType = CHRTRAN(FormatFieldValue, FieldLength,'')
>
>CASE FormatFieldName = 'SSN' && SSN_2100C_REF_02
>	NewFieldValue = ALLTRIM(TRANSFORM(STRTRAN(FieldValue,'-',''), '@R 999999999'))
>
>
>
>
>>See this thread Strange problem with RAT Thread #1168771
>>
>>>Good stuff, but much of the issue is that the value in the field for the example is "W9N", but it could just as easily be "ABC10AN" or something else. I'm trying to write something that will parse it apart not knowing exactly what it will be. There could be required alpha, then numeric (ABC10N), or there could be required numeric and alpha (12310A) or alpha and alphanumeric (ABC5AN). I can't see a way to handle it without knowing the values ahead of time.
>>>
>>>I have control of these values, so if there is a way to enter them that would make it better, please tell me.
>>>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform