Solved

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

Posted on 2011-09-14
1
273 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
1 Comment
 
LVL 25

Accepted Solution

by:
dgrafx earned 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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