AnsweredAssumed Answered

Python - Append Field mapping

Question asked by Pi-Hellz on Jun 19, 2012
Latest reply on Jun 22, 2012 by Pi-Hellz
Hi,

I'm trying to populate a DBase table from 2 tables with the Append_management tools. My script works fine but I would like to replace the absolute path in the field mapping with the 2 variables name and that doesn't work.

Working script
    

SitAct = r'C:\Temp\Deccan\SitRZValues.dbf'

ScePro = r'C:\Temp\Deccan\Sce_RZValues.dbf'

arcpy.Append_management("C:\\Temp\\Deccan\\Sce_RZValues.dbf;C:\\Temp\\Deccan\\SitRZValues.dbf", resultat, "NO_TEST", "RESPZONE \"RESPZONE\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,RESPZONE,-1,-1,C:\\Temp\\Deccan\\SitRZValues.dbf,RESPZONE,-1,-1;SITGA4 \"SITGA4\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\SitRZValues.dbf,GA4,-1,-1;SITGA12 \"SITGA12\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\SitRZValues.dbf,GA12,-1,-1;SITPPBRUT \"SITPPBRUT\" true false false 19 Double 0 19 ,First,#,C:\\Temp\\Deccan\\SitRZValues.dbf,SitPPBRUT,-1,-1;SITFFBRUT \"SITFFBRUT\" true false false 19 Double 0 19 ,First,#,C:\\Temp\\Deccan\\SitRZValues.dbf,SitFFBRUT,-1,-1;SITPP_TEMP \"SITPP_TEMP\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\SitRZValues.dbf,SitPPTEMPS,-1,-1;SITFF_TEMP \"SITFF_TEMP\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\SitRZValues.dbf,SitFFTEMPS,-1,-1;SCEGA4 \"SCEGA4\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,GA4,-1,-1;SCEGA12 \"SCEGA12\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,GA12,-1,-1;SCEPPBRUT \"SCEPPBRUT\" true false false 19 Double 0 19 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,ScePPBRUT,-1,-1;SCEFFBRUT \"SCEFFBRUT\" true false false 19 Double 0 19 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,SceFFBRUT,-1,-1;SCEPP_TEMP \"SCEPP_TEMP\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,ScePPTEMPS,-1,-1;SCEFF_TEMP \"SCEFF_TEMP\" true false false 20 Text 0 0 ,First,#,C:\\Temp\\Deccan\\Sce_RZValues.dbf,SceFFTEMPS,-1,-1", "")


Problematic script
As you see, I replace in red all the path with the variable name


SitAct = r'C:\Temp\Deccan\SitRZValues.dbf'

ScePro = r'C:\Temp\Deccan\Sce_RZValues.dbf'

    arcpy.Append_management([ScePro,SitAct], resultat, "NO_TEST", "RESPZONE \"RESPZONE\" true false false 20 Text 0 0 ,First,#,ScePro,RESPZONE,-1,-1,SitAct,RESPZONE,-1,-1;SITGA4 \"SITGA4\" true false false 20 Text 0 0 ,First,#,SitAct,GA4,-1,-1;SITGA12 \"SITGA12\" true false false 20 Text 0 0 ,First,#,SitAct,GA12,-1,-1;SITPPBRUT \"SITPPBRUT\" true false false 19 Double 0 19 ,First,#,SitAct,SitPPBRUT,-1,-1;SITFFBRUT \"SITFFBRUT\" true false false 19 Double 0 19 ,First,#,SitAct,SitFFBRUT,-1,-1;SITPP_TEMP \"SITPP_TEMP\" true false false 20 Text 0 0 ,First,#,SitAct,SitPPTEMPS,-1,-1;SITFF_TEMP \"SITFF_TEMP\" true false false 20 Text 0 0 ,First,#,SitAct,SitFFTEMPS,-1,-1;SCEGA4 \"SCEGA4\" true false false 20 Text 0 0 ,First,#,ScePro,GA4,-1,-1;SCEGA12 \"SCEGA12\" true false false 20 Text 0 0 ,First,#,ScePro,GA12,-1,-1;SCEPPBRUT \"SCEPPBRUT\" true false false 19 Double 0 19 ,First,#,ScePro,ScePPBRUT,-1,-1;SCEFFBRUT \"SCEFFBRUT\" true false false 19 Double 0 19 ,First,#,ScePro,SceFFBRUT,-1,-1;SCEPP_TEMP \"SCEPP_TEMP\" true false false 20 Text 0 0 ,First,#,ScePro,ScePPTEMPS,-1,-1;SCEFF_TEMP \"SCEFF_TEMP\" true false false 20 Text 0 0 ,First,#,ScePro,SceFFTEMPS,-1,-1", "")



Thanks you for you help

Pierre-Luc

Attachments

Outcomes