Ok, I've got a script created in coldfusion, and the way its written is that each variable name has a common prefix. The prefix is written out every time it is needed.
What I'd like to do is make it so that I can declare this prefix as a variable at the beginning of the document, and then affix the variable name to each instance that it is needed..
For instance, if I have the columns, "member_id, member_title, member_name"
They have corresponding variables that are used to contain data as a form is populated.
I'd like to be able to declare M = member, and then have "#M#_id, #M#_title, #M#_name"
That way if I wanted to change things, like from member to customer, I could simply go to the beginning of the document and set M = customer and throughout the document everything would use customer instead..
Problem is, I have to basically include a variable within a variable, and CFM doesn't seem to like that.
Take a simple query
<CFQUERY NAME="TEST" DATASOURCE="DATA">
SELECT member_id, member_title, member_name
FROM tbl_member_info
WHERE member_id = '#MYID#'
;
</CFQUERY>
I'd like to have it written something like
<CFQUERY NAME="TEST" DATASOURCE="DATA">
SELECT #M#_id, #M#_title, #M#_name
FROM tbl_#M#_info
WHERE #M#_id = '#MYID#'
;
</CFQUERY>
What I'd like to do is make it so that I can declare this prefix as a variable at the beginning of the document, and then affix the variable name to each instance that it is needed..
For instance, if I have the columns, "member_id, member_title, member_name"
They have corresponding variables that are used to contain data as a form is populated.
I'd like to be able to declare M = member, and then have "#M#_id, #M#_title, #M#_name"
That way if I wanted to change things, like from member to customer, I could simply go to the beginning of the document and set M = customer and throughout the document everything would use customer instead..
Problem is, I have to basically include a variable within a variable, and CFM doesn't seem to like that.
Take a simple query
<CFQUERY NAME="TEST" DATASOURCE="DATA">
SELECT member_id, member_title, member_name
FROM tbl_member_info
WHERE member_id = '#MYID#'
;
</CFQUERY>
I'd like to have it written something like
<CFQUERY NAME="TEST" DATASOURCE="DATA">
SELECT #M#_id, #M#_title, #M#_name
FROM tbl_#M#_info
WHERE #M#_id = '#MYID#'
;
</CFQUERY>