Solved

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

Posted on 2011-09-14
1
271 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now