Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

22 Experts available now in Live!

Get 1:1 Help Now