?
Solved

Issue with conditions and moving files using cffile action="move"

Posted on 2011-09-14
1
Medium Priority
?
277 Views
Last Modified: 2012-05-12
Hi,

I am having trouble in figuring out why files are not being moved using theh cffile action="move" tag.  Initially, I had the code so that the inner if statement was not there, it was handling one set of files.  Now that I placed a condition, to determine the type of file, it is not workiing. Any suggestions?

The condition that I added is this part:
 <cfif len(ListResult.NPSGroupNumber) eq 0>
                             <cffile action="move"
                                source="#ListResult.BnftChart_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\OBI\Approved\#ListResult.LOB#\">
                           
                                <cffile action="move"
                                source="#ListResult.CertRider_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\HTML\Approved\#ListResult.LOB#\">
 
                                                            <cfelseif len(ListResult.NPSGroupNumber) gt 0>
                                                        <cffile action="move"
                                source="#ListResult.BnftChart_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\OBI\Approved\#ListResult.LOB#\">
                               
                                <cffile action="move"
                                source="#ListResult.CertRider_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\HTML\Approved\#ListResult.LOB#\">
 
                                                </cfif>
 
                                   
 
 
 
 
Ahmad, Mubbeena<!---<cfinclude template="shared_scripts/getuserinfo.cfm">---> <cfsilent> <cfinvoke component="wf-test" method="getEmployeeInfo" returnvariable="employeeInfo"> <cfinvokeargument name="employeeNumber" value="#form.submitted_By#"> </cfinvoke> </cfsilent> <!DOCTYPE5:51 PM
Ahmad, Mubbeena<!---<cfinclude template="shared_scripts/getuserinfo.cfm">---> <cfsilent> <cfinvoke component="wf-test" method="getEmployeeInfo" returnvariable="employeeInfo"> <cfinvokeargument name="employeeNumber" value="#form.submitted_By#"> </cfinvoke> </cfsilent> <!DOCTYPE5:50 PM
Ahmad, MubbeenaActions
To:MAhmad, Mubbeena
 Wednesday, September 14, 2011 5:50 PM
    

<!---<cfinclude template="shared_scripts/getuserinfo.cfm">--->
<cfsilent>
 
<cfinvoke component="wf-test" method="getEmployeeInfo" returnvariable="employeeInfo">
      <cfinvokeargument name="employeeNumber" value="#form.submitted_By#">
</cfinvoke>
 
</cfsilent>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>OBI Status Check Tool</title>
            <link rel="stylesheet" type="text/css" href="css/structure.css">
            <link rel="stylesheet" type="text/css" href="css/form.css">
 
</head>
 
<cfparam name="url.start" default=1 />
 
<cfparam name="form.okay" default=1 /> 
 
<img src="images/trial1.jpg" align="CENTER" width="100%">
  <body id="public">
<cfset RecordCount = #form.totalRows#>
<cfset final = #form.id#>
 
<cfoutput>
<cfset userObj = createObject("component", "wf-test")>
            <!--- userObj is now component --->
            <cfset submittedByQry = userObj.getEmployeeInfo(val("#form.submitted_By#"))>
 
<CFLOOP from = "1" to = "#RecordCount#" index = "i"> 
 <cfif isdefined('FORM.GP#i#')>
 
 
            <cfset gpValue = FORM["gp"& i]>
 
            <cfif #val(gpValue)# eq 0>
                                    <cfinclude template="rejected_email.cfm">
                        
                                    
                                    <cfif #val(gpValue)# eq 1 >
                                      <CFQUERY DATASOURCE="Obi-default"  NAME="ListResult" >
                    select *
                    from NF_WMI
                    where TrackingNumber = #i#
                </CFQUERY>
                                    
                                                            <cfif len(ListResult.NPSGroupNumber) eq 0>
                             <cffile action="move"
                                source="#ListResult.BnftChart_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\OBI\Approved\#ListResult.LOB#\">
                            
                                <cffile action="move"
                                source="#ListResult.CertRider_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\HTML\Approved\#ListResult.LOB#\">
 
                                                            <cfelseif len(ListResult.NPSGroupNumber) gt 0>
                                                        <cffile action="move"
                                source="#ListResult.BnftChart_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\OBI\Approved\#ListResult.LOB#\">
                                
                                <cffile action="move"
                                source="#ListResult.CertRider_Path#"
                                destination="\\pwn401av213\obi-dev\WMI\HTML\Approved\#ListResult.LOB#\">
 
                                                </cfif>
 
                                    
 
 
 
         <CFQUERY name="apprvd" DATASOURCE="Obi-default" result="test">  
            UPDATE      NF_WMI   
            SET         StatusFlag = #val(gpValue)#,
            Approved_By = #submittedByQry.employeeNumber#,
            Approved_Date =  #Now()#
            WHERE TrackingNumber = #i# <!---#val(TrackingNumber)#--->
        
     </CFQUERY>   
   
   </cfif>
    </cfif>
   
   
   </cfif>
   
</CFLOOP>
 
   
</cfoutput>
  
<br/>
            <div id="container">
                                    <h1 id="logo">
                                    </h1>
 
    <div align="center">
                        <cfset name ="test" /> 
    </div>
    
    <div class="info" >
            <h2 align="center" >Benefits Recorded</h2>
    </div>
 
    <div align="center">
     <div class="info">
 <br/> 
      
          <table width="66%"  align="center" border="0" >
                            <tr>
             <td colspan="3"><div align="center"><b>The Benefit Charts have been saved.</b></div></td>
             </tr>
                            <tr>
                              <td colspan="3">&nbsp;</td>
                    </tr>
                            <tr>
                              <td colspan="3">&nbsp;</td>
                    </tr>
                                     
           <!---  <tr>
                                       <td width="19%" height="57"><div align="right"><b>Approved:</b></div></td>
                               <td width="81%"></td>
                            </tr>
                                     <tr>
                                       <td height="54"><div align="right"><b>Disapproved:</b></div></td>
                               <td>&nbsp;</td>
                            </tr>
                                     <tr>
                                       <td colspan="2">&nbsp;</td>
                            </tr>--->
                        
        <tr>
          <td width="40%"><div align="center">          </td>
          <td width="24%"> <div align="center"><a href="index.cfm" class="button" title="Home">Home</a>              </div>
          <div align="center"><a href="group.cfm" class="button" title="Listing Of Groups">Listings</a>          </div>
          <div align="center"></div>
          <p>&nbsp;</p></td>
          <td width="36%">&nbsp;</td>
        </tr>
       </table>
         
         
      
      </div>
         </div>
         </div>
         </body>
         </html>

Open in new window

0
Comment
Question by:armanbena
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 25

Accepted Solution

by:
dgrafx earned 2000 total points
ID: 36546614
first off i should say that it looks like you are doing the exact same thing whether the len(ListResult.NPSGroupNumber) is zero or greater than zero
either way its doing the same thing - maybe this is for testing ???
and also - when testing length its important to trim it as well as in len(trim(ListResult.NPSGroupNumber)) - just fyi

possibly the cfservice doesnt have permissions to the destination directory when accessing through the unc path.
do a test:
<cfset FileWrite("\\pwn401av213\obi-dev\WMI\OBI\Approved\testing.txt\","Hello World")>
0

Featured Post

Automating Terraform w Jenkins & AWS CodeCommit

How to configure Jenkins and CodeCommit to allow users to easily create and destroy infrastructure using Terraform code.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question