Dynamic filename with msg.filename

Hi,
I have to write my payload to a file with Dynamic filename each of time using msg.filename.
In the the function i am using msg.filename= 'E:\Software\DFQ\abc.DFQ' but file is not getting generated and but when i keep a static one it is getting generated. In the loop function i wanted to use arr[0].K1002 value as filename.

[{"id":"1325dbcf1a62446d","type":"tab","label":"Flow 4","disabled":false,"info":"","env":[]},{"id":"9f08546e2606dede","type":"inject","z":"1325dbcf1a62446d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":160,"wires":[["81db7c11b29ea005"]]},{"id":"81db7c11b29ea005","type":"MSSQL","z":"1325dbcf1a62446d","mssqlCN":"aa7d89b7abab77e6","name":"","outField":"payload","returnType":0,"throwErrors":1,"query":"SELECT TOP 1 [ID]\r\n      ,[Date_Time]\r\n      ,[Vin_Number]\r\n      ,[Vehicle_Code]\r\n      ,[Machine_Id]\r\n      ,[Type_Name]\r\n      ,[No_of_Axle]\r\n      ,[FF_ToeL]\r\n      ,[FF_ToeR]\r\n      ,[FF_ToeMin]\r\n      ,[FF_ToeMax]\r\n      ,[FF_CamberL]\r\n      ,[FF_CamberR]\r\n      ,[FF_CamberMin]\r\n      ,[FF_CamberMax]\r\n      ,[FF_CasterL]\r\n      ,[FF_CasterR]\r\n      ,[FF_CasterMin]\r\n      ,[FF_CasterMax]\r\n      ,[FF_KingpinL]\r\n      ,[FF_KingpinR]\r\n      ,[FF_KingpinLMin]\r\n      ,[FF_KingpinLMax]\r\n      ,[FF_InnerWheel_L]\r\n      ,[FF_InnerWheel_R]\r\n      ,[FF_InnerWheel_Min]\r\n      ,[FF_InnerWheel_Max]\r\n      ,[FF_OuterWheel_L]\r\n      ,[FF_OuterWheel_R]\r\n      ,[FF_OuterWheel_Min]\r\n      ,[FF_OuterWheel_Max]\r\n      ,[FF_TotalToe]\r\n      ,[FF_TotalToeMin]\r\n      ,[FF_TotalToeMax]\r\n      ,[FF_DriveAngle]\r\n      ,[FF_DriveAngleMin]\r\n      ,[FF_DriveAngleMax]\r\n      ,[FF_AxleCenter]\r\n      ,[FF_AxleCenterMin]\r\n      ,[FF_AxleCenterMax]\r\n      ,[FF_SWBAngle]\r\n      ,[FF_SWBAngleMin]\r\n      ,[FF_SWBAngleMax]\r\n      ,[FR_Spacing_L]\r\n      ,[FR_Spacing_R]\r\n      ,[FR_Spacing_Min]\r\n      ,[FR_Spacing_Max]\r\n      ,[FR_ToeL]\r\n      ,[FR_ToeR]\r\n      ,[FR_ToeMin]\r\n      ,[FR_ToeMax]\r\n      ,[FR_CamberL]\r\n      ,[FR_CamberR]\r\n      ,[FR_CamberMin]\r\n      ,[FR_CamberMax]\r\n      ,[FR_CasterL]\r\n      ,[FR_CasterR]\r\n      ,[FR_CasterMin]\r\n      ,[FR_CasterMax]\r\n      ,[FR_KingpinL]\r\n      ,[FR_KingpinR]\r\n      ,[FR_KingpinLMin]\r\n      ,[FR_KingpinLMax]\r\n      ,[FR_InnerWheel_L]\r\n      ,[FR_InnerWheel_R]\r\n      ,[FR_InnerWheel_Min]\r\n      ,[FR_InnerWheel_Max]\r\n      ,[FR_OuterWheel_L]\r\n      ,[FR_OuterWheel_R]\r\n      ,[FR_OuterWheel_Min]\r\n      ,[FR_OuterWheel_Max]\r\n      ,[FR_TotalToe]\r\n      ,[FR_TotalToeMin]\r\n      ,[FR_TotalToeMax]\r\n      ,[FR_DriveAngle]\r\n      ,[FR_DriveAngleMin]\r\n      ,[FR_DriveAngleMax]\r\n      ,[FR_AxleCenter]\r\n      ,[FR_AxleCenterMin]\r\n      ,[FR_AxleCenterMax]\r\n      ,[FR_Skewness]\r\n      ,[FR_SkewnessMin]\r\n      ,[FR_SkewnessMax]\r\n      ,[FR2_Spacing_L]\r\n      ,[FR2_Spacing_R]\r\n      ,[FR2_Spacing_Min]\r\n      ,[FR2_Spacing_Max]\r\n      ,[FR2_ToeL]\r\n      ,[FR2_ToeR]\r\n      ,[FR2_ToeMin]\r\n      ,[FR2_ToeMax]\r\n      ,[FR2_CamberL]\r\n      ,[FR2_CamberR]\r\n      ,[FR2_CamberMin]\r\n      ,[FR2_CamberMax]\r\n      ,[FR2_TotalToe]\r\n      ,[FR2_TotalToeMin]\r\n      ,[FR2_TotalToeMax]\r\n      ,[FR2_DriveAngle]\r\n      ,[FR2_DriveAngleMin]\r\n      ,[FR2_DriveAngleMax]\r\n      ,[FR2_AxleCenter]\r\n      ,[FR2_AxleCenterMin]\r\n      ,[FR2_AxleCenterMax]\r\n      ,[FR2_Skewness]\r\n      ,[FR2_SkewnessMin]\r\n      ,[FR2_SkewnessMax]\r\n      ,[RF_Spacing_L]\r\n      ,[RF_Spacing_R]\r\n      ,[RF_Spacing_Min]\r\n      ,[RF_Spacing_Max]\r\n      ,[RF_ToeL]\r\n      ,[RF_ToeR]\r\n      ,[RF_ToeMin]\r\n      ,[RF_ToeMax]\r\n      ,[RF_CamberL]\r\n      ,[RF_CamberR]\r\n      ,[RF_CamberMin]\r\n      ,[RF_CamberMax]\r\n      ,[RF_TotalToe]\r\n      ,[RF_TotalToeMin]\r\n      ,[RF_TotalToeMax]\r\n      ,[RF_DriveAngle]\r\n      ,[RF_DriveAngleMin]\r\n      ,[RF_DriveAngleMax]\r\n      ,[RF_AxleCenter]\r\n      ,[RF_AxleCenterMin]\r\n      ,[RF_AxleCenterMax]\r\n      ,[RF_Skewness]\r\n      ,[RF_SkewnessMin]\r\n      ,[RF_SkewnessMax]\r\n      ,[RR_Spacing_L]\r\n      ,[RR_Spacing_R]\r\n      ,[RR_Spacing_Min]\r\n      ,[RR_Spacing_Max]\r\n      ,[RR_ToeL]\r\n      ,[RR_ToeR]\r\n      ,[RR_ToeMin]\r\n      ,[RR_ToeMax]\r\n      ,[RR_CamberL]\r\n      ,[RR_CamberR]\r\n      ,[RR_CamberMin]\r\n      ,[RR_CamberMax]\r\n      ,[RR_TotalToe]\r\n      ,[RR_TotalToeMin]\r\n      ,[RR_TotalToeMax]\r\n      ,[RR_DriveAngle]\r\n      ,[RR_DriveAngleMin]\r\n      ,[RR_DriveAngleMax]\r\n      ,[RR_AxleCenter]\r\n      ,[RR_AxleCenterMin]\r\n      ,[RR_AxleCenterMax]\r\n      ,[RR_Skewness]\r\n      ,[RR_SkewnessMin]\r\n      ,[RR_SkewnessMax]\r\n      ,[Master_ID]\r\n  FROM [WAM1].[dbo].[WAM1]\r\n  order by Date_Time DESC","modeOpt":"queryMode","modeOptType":"query","queryOpt":"payload","queryOptType":"editor","paramsOpt":"queryParams","paramsOptType":"none","rows":"rows","rowsType":"msg","params":[],"x":420,"y":160,"wires":[["f193fd127a229639"]]},{"id":"f193fd127a229639","type":"function","z":"1325dbcf1a62446d","name":"","func":"var obj = msg.payload\nvar selobj = obj[0];\n\nvar id = Number(selobj.ID);\nvar P1 = selobj.Date_Time;\nvar P2 = selobj.Vin_Number;\nvar P3 = selobj.Vehicle_Code;\nvar P4 = selobj.Machine_Id;\nvar P5 =selobj.Type_Name;\nvar P6 =selobj.No_of_Axle;\nvar P7 =selobj.FF_ToeL;\nvar P8 =selobj.FF_ToeR;\nvar P9 =selobj.FF_ToeMin;\nvar P10 =selobj.FF_ToeMax;\nvar P11 =selobj.FF_CamberL;\nvar P12 =selobj.FF_CamberR;\nvar P13 =selobj.FF_CamberMin;\nvar P14 =selobj.FF_CamberMax;\nvar P15 =selobj.FF_CasterL;\nvar P16 =selobj.FF_CasterR;\nvar P17 =selobj.FF_CasterMin;\nvar P18 =selobj.FF_CasterMax;\nvar P19 =selobj.FF_KingpinL;\nvar P20 =selobj.FF_KingpinR;\nvar P21 =selobj.FF_KingpinLMin\nvar P22 =selobj.FF_KingpinLMax;\nvar P23 =selobj.FF_InnerWheel_L;\nvar P24 =selobj.FF_InnerWheel_R;\nvar P25 =selobj.FF_InnerWheel_Min;\nvar P26 =selobj.FF_InnerWheel_Max;\nvar P27 =selobj.FF_OuterWheel_L;\nvar P28 =selobj.FF_OuterWheel_R;\nvar P29 =selobj.FF_OuterWheel_Min;\nvar P30 =selobj.FF_OuterWheel_Max;\nvar P31 =selobj.FF_TotalToe;\nvar P32 =selobj.FF_TotalToeMin;\nvar P33 =selobj.FF_TotalToeMax;\nvar P34 =selobj.FF_DriveAngle;\nvar P35 =selobj.FF_DriveAngleMin;\nvar P36 =selobj.FF_DriveAngleMax;\nvar P37 =selobj.FF_AxleCenter;\nvar P38 =selobj.FF_AxleCenterMin;\nvar P39 =selobj.FF_AxleCenterMax;\nvar P40 =selobj.FF_SWBAngle;\nvar P41 =selobj.FF_SWBAngleMin;\nvar P42 =selobj.FF_SWBAngleMax;\nvar P43 =selobj.FR_Spacing_L;\nvar P44 =selobj.FR_Spacing_R;\nvar P45 =selobj.FR_Spacing_Min;\nvar P46 =selobj.FR_Spacing_Max;\nvar P47 =selobj.FR_ToeL;\nvar P48 =selobj.FR_ToeR;\nvar P49 =selobj.FR_ToeMin;\nvar P50 =selobj.FR_ToeMax;\nvar P51 =selobj.FR_CamberL;\nvar P52 =selobj.FR_CamberR;\nvar P53 =selobj.FR_CamberMin;\nvar P54 =selobj.FR_CamberMax;\nvar P55 =selobj.FR_CasterL;\nvar P56 =selobj.FR_CasterR;\nvar P57 =selobj.FR_CasterMin;\nvar P58 =selobj.FR_CasterMax;\nvar P59 =selobj.FR_KingpinL;\nvar P60 =selobj.FR_KingpinR;\nvar P61 =selobj.FR_KingpinLMin;\nvar P62 =selobj.FR_KingpinLMax;\nvar P63 =selobj.FR_InnerWheel_L;\nvar P64 =selobj.FR_InnerWheel_R;\nvar P65 =selobj.FR_InnerWheel_Min;\nvar P66 =selobj.FR_InnerWheel_Max;\nvar P67 =selobj.FR_OuterWheel_L;\nvar P68 =selobj.FR_OuterWheel_R;\nvar P69 =selobj.FR_OuterWheel_Min;\nvar P70 =selobj.FR_OuterWheel_Max;\nvar P71 =selobj.FR_TotalToe;\nvar P72 =selobj.FR_TotalToeMin;\nvar P73 =selobj.FR_TotalToeMax;\nvar P74 =selobj.FR_DriveAngle;\nvar P75 =selobj.FR_DriveAngleMin;\nvar P76 =selobj.FR_DriveAngleMax;\nvar P77 =selobj.FR_AxleCenter;\nvar P78 =selobj.FR_AxleCenterMin;\nvar P79 =selobj.FR_AxleCenterMax;\nvar P80 =selobj.FR_Skewness;\nvar P81 =selobj.FR_SkewnessMin;\nvar P82 =selobj.FR_SkewnessMax;\nvar P83 =selobj.FR2_Spacing_L;\nvar P84 =selobj.FR2_Spacing_R;\nvar P85 =selobj.FR2_Spacing_Min;\nvar P86 =selobj.FR2_Spacing_Max;\nvar P87 =selobj.FR2_ToeL;\nvar P88 =selobj.FR2_ToeR;\nvar P89 =selobj.FR2_ToeMin;\nvar P90 =selobj.FR2_ToeMax;\nvar P91 =selobj.FR2_CamberL;\nvar P92 =selobj.FR2_CamberR;\nvar P93 =selobj.FR2_CamberMin;\nvar P94 =selobj.FR2_CamberMax;\nvar P95 =selobj.FR2_TotalToe;\nvar P96 =selobj.FR2_TotalToeMin;\nvar P97 =selobj.FR2_TotalToeMax;\nvar P98 =selobj.FR2_DriveAngle;\nvar P99 =selobj.FR2_DriveAngleMin;\nvar P100 =selobj.FR2_DriveAngleMax;\nvar P101 =selobj.FR2_AxleCenter;\nvar P102 =selobj.FR2_AxleCenterMin;\nvar P103 =selobj.FR2_AxleCenterMax;\nvar P104 =selobj.FR2_Skewness;\nvar P105 =selobj.FR2_SkewnessMin;\nvar P106 =selobj.FR2_SkewnessMax;\nvar P107 =selobj.RF_Spacing_L;\nvar P108 =selobj.RF_Spacing_R;\nvar P109 =selobj.RF_Spacing_Min;\nvar P110 =selobj.RF_Spacing_Max;\nvar P111 =selobj.RF_ToeL;\nvar P112 =selobj.RF_ToeR;\nvar P113 =selobj.RF_ToeMin;\nvar P114 =selobj.RF_ToeMax;\nvar P115 =selobj.RF_CamberL;\nvar P116 =selobj.RF_CamberR;\nvar P117 =selobj.RF_CamberMin;\nvar P118 =selobj.RF_CamberMax;\nvar P119 =selobj.RF_TotalToe;\nvar P120 =selobj.RF_TotalToeMin;\nvar P121 =selobj.RF_TotalToeMax;\nvar P122 =selobj.RF_Outofsquare;\nvar P123 =selobj.RF_OutofsquareMin;\nvar P124 =selobj.RF_OutofsquareMax;\nvar P125 =selobj.RF_DriveAngle;\nvar P126 =selobj.RF_DriveAngleMin;\nvar P127 =selobj.RF_DriveAngleMax;\nvar P128 =selobj.RF_AxleCenter;\nvar P129 =selobj.RF_AxleCenterMin;\nvar P130 =selobj.RF_AxleCenterMax;\nvar P131 =selobj.RF_Skewness;\nvar P132 =selobj.RF_SkewnessMin;\nvar P133 =selobj.RF_SkewnessMax;\nvar P134 =selobj.RR_Spacing_L;\nvar P135 =selobj.RR_Spacing_R;\nvar P136 =selobj.RR_Spacing_Min;\nvar P137 =selobj.RR_Spacing_Max;\nvar P138 =selobj.RR_ToeL;\nvar P139 =selobj.RR_ToeR;\nvar P140 =selobj.RR_ToeMin;\nvar P141 =selobj.RR_ToeMax;\nvar P142 =selobj.RR_CamberL;\nvar P143 =selobj.RR_CamberR;\nvar P144 =selobj.RR_CamberMin;\nvar P145 =selobj.RR_CamberMax;\nvar P146 =selobj.RR_TotalToe;\nvar P147 =selobj.RR_TotalToeMin;\nvar P148 =selobj.RR_TotalToeMax;\nvar P149 =selobj.RR_DriveAngle;\nvar P150 =selobj.RR_DriveAngleMin;\nvar P151 =selobj.RR_DriveAngleMax;\nvar P152 =selobj.RR_AxleCenter;\nvar P153 =selobj.RR_AxleCenterMin;\nvar P154 =selobj.RR_AxleCenterMax;\nvar P155 =selobj.RR_Skewness;\nvar P156 =selobj.RR_SkewnessMin;\nvar P157 =selobj.RR_SkewnessMax;\nvar P160 = \"Wheel Alignment Machine-1\";\nvar P161 = \"Front_Toe_LH\";\nvar P162 = \"Front_Toe_RH\";\nvar P163 = \"Front_Camber_LH\";\nvar P164 = \"Front_Camber_RH\";\nvar P165=\"Front_CasterLH\";\nvar P166=\"Front_Caster_RH\";\nvar P167=\"Front_KingpinLH\";\nvar P168=\"Front_KingpinRH\";\nvar P169=\"Front_Lock_Angle_Inner_LH\";\nvar P170=\"Front_Lock_Angle_Inner_RH\";\nvar P171=\"Front_Lock_Angle_Outer_LH\";\nvar P172=\"Front_Lock_Angle_Outer_RH\";\nvar P173=\"Front_TotalToe\";\nvar P174=\"Front_Parallelism\";\nvar P175=\"Front_Axle_Shift\";\nvar P176=\"Steering _Wheel_Ailgnment\";\nvar P177=\"Parallelism\";\nvar P178=\"Out_Of_Squareness\";\nvar P179=\"FR_Toe_LH\";\nvar P180=\"FR_Toe_RH\";\nvar P181=\"FR_Total_Toe\";\nvar P182=\"FR_Parallelism\";\nvar P183=\"FR_Axle_Shift\";\nvar P184=\"FR_Axle_Spacing\";\nvar P185=\"FR_Skewness\";\nvar P186=\"FR_LH_Caster\";\nvar P187=\"FR_RH_Caster\";\nvar P188=\"FR_LH_Camber\";\nvar P189=\"FR_RH_Camber\";\nvar P190=\"FR_King_Pin_LH\";\nvar P191=\"FR_King_Pin_RH\";\nvar P192=\"FR_Lock_Angle_Inner_LH\";\nvar P193=\"FR_Lock_Angle_Inner_RH\";\nvar P194=\"FR_Lock_Angle_Outer_LH\";\nvar P195=\"FR_Lock_Angle_Outer_RH\";\nvar P196=\"FR2_Toe_LH\";\nvar P197=\"FR2_Toe_RH\";\nvar P198=\"FR2_Total_Toe\";\nvar P199=\"FR2_Axle_Spacing\";\nvar P200=\"FR2_Axle_Shift\";\nvar P201=\"FR2_Skewness\";\nvar P202=\"FR2_Parallelism\";\nvar P203=\"FR2_LH_Camber\";\nvar P204=\"FR2_RH_Camber\"\n\n\nmsg.payload[0] = {K0100: 65, K1001: P2,K1002: P5,K1081:12345,K1082:P160,K0008:812562}\nmsg.payload[1]=  {\"Id\":P161,\"Val\":P7,\"Min\":P9,\"Max\":P10};\nmsg.payload[2]=  {\"Id\":P162,\"Val\":P8,\"Min\":P9,\"Max\":P10};\nmsg.payload[3]=  {\"Id\":P163,\"Val\":P11,\"Min\":P13,\"Max\":P14};\nmsg.payload[4]=  {\"Id\":P164,\"Val\":P12,\"Min\":P13,\"Max\":P14};\nmsg.payload[5]=  {\"Id\":P165,\"Val\":P15,\"Min\":P17,\"Max\":P18};\nmsg.payload[6]=  {\"Id\":P166,\"Val\":P16,\"Min\":P17,\"Max\":P18};\nmsg.payload[7]=  {\"Id\":P167,\"Val\":P19,\"Min\":P21,\"Max\":P22};\nmsg.payload[8]=  {\"Id\":P168,\"Val\":P20,\"Min\":P21,\"Max\":P22};\nmsg.payload[9]=  {\"Id\":P169,\"Val\":P23,\"Min\":P25,\"Max\":P26};\nmsg.payload[10]=  {\"Id\":P170,\"Val\":P24,\"Min\":P25,\"Max\":P26};\nmsg.payload[11]=  {\"Id\":P171,\"Val\":P27,\"Min\":P29,\"Max\":P30};\nmsg.payload[12]=  {\"Id\":P172,\"Val\":P28,\"Min\":P29,\"Max\":P30};\nmsg.payload[13]=  {\"Id\":P173,\"Val\":P31,\"Min\":P32,\"Max\":P33};\nmsg.payload[14]=  {\"Id\":P174,\"Val\":P34,\"Min\":P35,\"Max\":P36};\nmsg.payload[15]=  {\"Id\":P175,\"Val\":P37,\"Min\":P38,\"Max\":P39};\nmsg.payload[16]=  {\"Id\":P176,\"Val\":P40,\"Min\":P41,\"Max\":P42};\nmsg.payload[17]=  {\"Id\":P177,\"Val\":P77,\"Min\":P78,\"Max\":P79};\nmsg.payload[18]=  {\"Id\":P178,\"Val\":P74,\"Min\":P75,\"Max\":P76};\nmsg.payload[19]=  {\"Id\":P179,\"Val\":P47,\"Min\":P49,\"Max\":P50};\nmsg.payload[20]=  {\"Id\":P180,\"Val\":P48,\"Min\":P49,\"Max\":P50};\nmsg.payload[21]=  {\"Id\":P181,\"Val\":P71,\"Min\":P72,\"Max\":P73};\nmsg.payload[22]=  {\"Id\":P182,\"Val\":P74,\"Min\":P75,\"Max\":P76};\nmsg.payload[23]=  {\"Id\":P183,\"Val\":P77,\"Min\":P78,\"Max\":P79};\nmsg.payload[24]=  {\"Id\":P184,\"Val\":P83,\"Min\":P85,\"Max\":P86};\nmsg.payload[25]=  {\"Id\":P185,\"Val\":P80,\"Min\":P81,\"Max\":P82};\nmsg.payload[26]=  {\"Id\":P186,\"Val\":P55,\"Min\":P57,\"Max\":P58};\nmsg.payload[27]=  {\"Id\":P187,\"Val\":P56,\"Min\":P57,\"Max\":P58};\nmsg.payload[28]=  {\"Id\":P188,\"Val\":P51,\"Min\":P53,\"Max\":P54};\nmsg.payload[29]=  {\"Id\":P189,\"Val\":P52,\"Min\":P53,\"Max\":P54};\nmsg.payload[30]=  {\"Id\":P190,\"Val\":P59,\"Min\":P61,\"Max\":P62};\nmsg.payload[31]=  {\"Id\":P191,\"Val\":P60,\"Min\":P61,\"Max\":P62};\nmsg.payload[32]=  {\"Id\":P192,\"Val\":P63,\"Min\":P65,\"Max\":P66};\nmsg.payload[33]=  {\"Id\":P193,\"Val\":P64,\"Min\":P65,\"Max\":P66};\nmsg.payload[34]=  {\"Id\":P194,\"Val\":P67,\"Min\":P69,\"Max\":P70};\nmsg.payload[35]=  {\"Id\":P195,\"Val\":P68,\"Min\":P69,\"Max\":P70};///\nmsg.payload[36]=  {\"Id\":P196,\"Val\":P87,\"Min\":P89,\"Max\":P90};\nmsg.payload[37]=  {\"Id\":P197,\"Val\":P88,\"Min\":P89,\"Max\":P90};\nmsg.payload[38]=  {\"Id\":P198,\"Val\":P95,\"Min\":P96,\"Max\":P97};\nmsg.payload[39]=  {\"Id\":P199,\"Val\":P83,\"Min\":P85,\"Max\":P86};\nmsg.payload[40]=  {\"Id\":P200,\"Val\":P101,\"Min\":P102,\"Max\":P103};\nmsg.payload[41]=  {\"Id\":P201,\"Val\":P104,\"Min\":P105,\"Max\":P106};\nmsg.payload[42]=  {\"Id\":P202,\"Val\":P98,\"Min\":P99,\"Max\":P100};\nmsg.payload[43]=  {\"Id\":P203,\"Val\":P91,\"Min\":P93,\"Max\":P94};\nmsg.payload[44]=  {\"Id\":P204,\"Val\":P92,\"Min\":P93,\"Max\":P94};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":160,"wires":[["6482748bb17a3ad2"]]},{"id":"6482748bb17a3ad2","type":"function","z":"1325dbcf1a62446d","name":"","func":"var arr = msg.payload;\n\nvar dataarr = [];\nvar lval;\nvar chr0 = \"\";\nvar chr1 = \"\";\nvar chr2 = \"\";\nvar i=0;\nvar cdt = new Date();\nvar dt = (cdt.getMonth()+1) + '.' + (cdt.getDate()) + '.' + cdt.getFullYear() + '/' + (cdt.getHours()) + ':' + (cdt.getMinutes()) + ':' + (cdt.getSeconds());\nmsg.wam = \"\";\n\nchr0 = \"K0100 \" + (arr.length - 1) + \"\\r\\n\";\nchr0 = chr0 + \"K1001 \" + arr[0].K1001 + \"\\r\\n\";\nchr0 = chr0 + \"K1002 \" + arr[0].K1002 + \"\\r\\n\";\nchr0 = chr0 + \"K1081 \" + arr[0].K1081 + \"\\r\\n\";\nchr0 = chr0 + \"K1082 \" + arr[0].K1082 + \"\\r\\n\";\nchr0 = chr0 + \"K0008 \" + arr[0].K0008 + \"\\r\\n\";\n\narr.forEach(function(e){\n    if(i>0){\n        chr1 = chr1 + \"K2001/\" + i + \" \" + i + \"\\r\\n\";\n        chr1 = chr1 + \"K2002/\" + i + \" \" + e.Id + \"\\r\\n\";\n        chr1 = chr1 + \"K2101/\" + i + \" \" + e.Val+ \"\\r\\n\";\n        chr1 = chr1 + \"K2110/\" + i + \" \" + e.Min + \"\\r\\n\";\n        chr1 = chr1 + \"K2111/\" + i + \" \" + e.Max + \"\\r\\n\";\n    }\n    i = i+1;\n});\ni=0;\narr.forEach(function(e){\n    if(i>0){\n        chr2 = chr2 + e.Val + String.fromCharCode(20) + \"0\" + String.fromCharCode(20) + dt + String.fromCharCode(15);\n    }\n    i=i+1;\n});\nmsg.payload = chr0 + chr1 + \"\\r\\n\" + chr2;\nmsg.filename='E:\\Software\\DFQ\\abcd.DFQ';\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":800,"y":160,"wires":[["fe9b768894c20283"]]},{"id":"fe9b768894c20283","type":"file","z":"1325dbcf1a62446d","name":"","filename":"E:\\Software\\DFQ\\abc.DFQ","appendNewline":false,"createDir":true,"overwriteFile":"true","encoding":"none","x":1100,"y":160,"wires":[[]]},{"id":"aa7d89b7abab77e6","type":"MSSQL-CN","tdsVersion":"7_4","name":"WAM_TEST","server":"172.27.190.41","port":"1433","encyption":false,"trustServerCertificate":false,"database":"WAM1","useUTC":true,"connectTimeout":"15000","requestTimeout":"15000","cancelTimeout":"5000","pool":"5","parseJSON":false,"enableArithAbort":true}]

You may need to make a smaller working example.

I can't help as I don't have the file/s you are using. So can't really know what is going on.

In the file node select msg in the filename input field and then type filename


Or leave the path field blank.

What version of node you are using, mine doesn't have dropdown property under filename. I also have tried keeping filename as empty but it doesn't create the file.

node-red version 3.0.2, nodejs 14.

Then just leave the field blank as i advise for alternative. You can also try using \\ instead of \, or you can use / instead of \. I don't use widows, but i believe it accepts / these days in paths.

I'm JavaScript strings, a backsplash means escape the next character. To provide a Windows style path you will need to escape the backslash e.g...

msg.filename= 'E:\\Software\\DFQ\\abc.DFQ'

Alternatively, use regular slashes e.g.

msg.filename= 'E:/Software/DFQ/abc.DFQ'

Thanks Steve,
It works. As mentioned earlier, The filename must be dynamic not fixed each of the time which must be same as my one of the array value (arr[0].K1001). Kindly help.

Are you asking:

msg.filename= arr[0].K1002

?

Partially,
msg.filename='E:/Software/DFQ/123.DFQ';
Where E:/Software/DFQ/ is my path and 123 is the variable containing filename and .DFQ is my file format.

msg.filename= `E:/Software/DFQ/${arr[0].K1002}.DFQ`
1 Like

Thank you. Its working.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.