Thanks for all your help BKBK!
I got the logout method working and I think I am getting close on the query part, but I am still having issues. The problem is, I do not have a form for the user to chose their pdf. I want to pass it in a string like this, the coldfusionpage.cfm is the code from above that takes all the credentials.
http://localhost/coldfusionpage.cfm?subdir=23&page_id=624010.pdf
Where the page_id is the fileID in the API request.
<!--- Get PDF File --->
<cfif structKeyExists(variables, "sessionKey") and len(trim(variables.sessionKey))>
<cfset cabinetName = "Surveys" />
<cfset fileID = "624010" />
<cfset tifOnly = false />
I know I need a select staement, something like this:
<cfquery name="getID" datasource="sire_2" dbtype="odbc">
SELECT page_id
FROM slco_sire.dbo.surveys_page
</cfquery>
and you suggested using
<cfif structKeyExists(variables, "userID") and len(trim(variables.userID)) GT 0 and len(trim(getAuthUser())) GT 0>
<cfset cabinetName = "Surveys">
<cfset fileID = getID.id>
<cfset tifOnly = false>
I am just having a hard-time tying this all together.
You all have gone above and beyond and I understand if I have maxed you out.![]()
Based on the information you've just provided, I will advise you to ignore my suggestion about the query. If, as you say, the file ID is coming in via the URL
http://localhost/coldfusionpage.cfm?subdir=23&page_id=624010.pdf
then simply replace
<cfset fileID = "624010" />
with
<cfset fileID = listGetAt(URL.page_id, 1, ".") />
That is dynamic enough. With no CPU-consuming query in sight!
Thanks BKBK.
So I tried your suggestion and the API seems to not like using this <cfset fileID = listGetAt(URL.page_id, 1, ".") /> instead of a hard-coded fileID. If I pass something like this, http://localhost/coldfusionpage.cfm?subdir=23&page_id=624010.pdf,
are the values suppossed to be exchanged for hard-coded ones? Does it treat this call like a variable?
Thanks!
Emily LaMunyon wrote:
So I tried your suggestion and the API seems to not like using this <cfset fileID = listGetAt(URL.page_id, 1, ".") />
Pease expand on what you mean by "seems not to like". If the code
<cfset fileID = "624010" />
works, then I expect
<cfset fileID = listGetAt(URL.page_id, 1, ".") />
to work, too.
I assume that you intend, in every case, to extract the fileID from the file-name of the PDF that comes in through the URL. In the URL you've given, that file-name is the variable URL.page_id. Its value is "624010.pdf". You could treate this as a list with delimiter ".". In that case, "624010" will be the first list element. This is what the last line of code does.
North America
Europe, Middle East and Africa
Asia Pacific