Solved

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

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
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 …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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