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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

determining the nth character of a field

Status
Not open for further replies.

t16turbo

Programmer
Mar 22, 2005
315
GB
how can I determine the 7th character of a field?
I need to use this in an IF statement to set a string variable.
any ideas?
 
RIght, I managed to figure this one out with a basic IF statement :
Code:
IF mid(cst_DSTI_PROJ_REF, 7, 1) = "D" then
g_label = "Development"
elseif mid(cst_DSTI_PROJ_REF, 7, 1) = "S" then
g_label = "Design"
END IF

I now need to embed this within another statement that checks if the first 2 digits of the project reference are "D0" first. If they are, then do the above statement, else take the 9th character.

my code returns an error in actuate which has a yellow arrow pointing to the nested IF statement.
can anyone see any problems with this?
Code:
if mid(cst_DSTI_PROJ_REF, 1, 2) = "D0" then
	(IF mid(cst_DSTI_PROJ_REF, 7, 1) = "D" then
	g_label = "Development"
	elseif mid(cst_DSTI_PROJ_REF, 7, 1) = "S" then
	g_label = "Design"
	END IF)
elseif mid(cst_DSTI_PROJ_REF, 9, 1) = "D" 
then
	g_label = "Development"
elseif  mid(cst_DSTI_PROJ_REF, 9, 1) = "S" 
then
	g_label = "Design"

	END IF

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top