Function not defined, requestFileTransfer

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
GrahamRA
Posts:6
Joined: Wed Dec 09, 2020 12:46 pm

Function not defined, requestFileTransfer

Post by GrahamRA »

Hi WinCC OA people,

I've encountered a peculiar issue which I don't understand, and am hoping somebody might be able to help me with.

The system I'm developing has a requirement that certain log files be viewable from within our WinCC OA application.

To achieve this, each host places a copy of the relevant log files in PROJECT_DIR/log/shared/<HOSTNAME>/ (where <HOSTNAME> is the hostname of the device on the network) so that the files can be transfered using WinCC OA.

My problem is this: the function I want to use to transfer the files, requestFileTransfer(), only seems works within a Ctrl Script.

I've written the following example code which I've placed:
  • In the "Initialise" event of a blank panel: requestFileTransfer_Example.xml
  • In a *.ctl script executed by a Ctrl manager in pmon: requestFileTransfer_Example.ctl

Code: Select all

main()
{
  int manId = convManIdToInt(EVENT_MAN, 0);
  
  anytype requestResult = requestFileTransfer(manId, makeDynString("log/shared/loggy.txt"));
  DebugTN("request", requestResult);
  
  int pending = 1;
  while(pending > 0)
  {
    pending = getPendingFileTransferCount();
    DebugTN("getPendingFileTransferCount", pending);
    delay(1);
  }
}
When running the requestFileTransfer_Example.ctl script within a Control Manager, the code executes as expected and the file is transferred from the server project to the client project.

However when starting the requestFileTransfer_Example.xml panel within gedi, the following error is raised:

Code: Select all

WCCOAui      (3), 2020.12.16 10:14:16.654, CTRL, SEVERE,    176, Uncaught exception in thread started at main: 
WCCOAui      (3), 2020.12.16 10:14:16.654, CTRL, SEVERE,     72, Function not defined, 
    Module: _QuickTest_
    Panel: C:\WinCC_OA_Proj\HCI_Client\panels\requestFileTransfer_Example.xml [requestFileTransfer_Example.xml]
    Script: Initialize
    Line: 5, requestFileTransfer
	Stacktrace:
	     1: main() at [Module: _QuickTest_ Panel: requestFileTransfer_Example.xml Script: Initialize]:5
Any idea why this might be the case?

I note additionally, that the documentation states that the return type of function requestFileTransfer() is dyn_mapping but it actually returns an int. I guess this is an oversight on the part of whoever wrote the docs?

Note, I've attampted to attach the files to this post but the forum page isn't having any of it—sorry about that.

Running WinCC OA 3.17 P006 on Windows 10 20H2

With thanks,

Graham R. Armstrong
Software Engineer
Applied Integration UK Ltd

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Function not defined, requestFileTransfer

Post by leoknipp »

When you look at the WinCC OA Documentation for the function requestFileTransfer() you will find the information that this function is only available in "CTRL".
In a UI manager this function cannot be used.
If you want to get files from a specific UI you can call the function requestFileTransfer() in a CTRL manager on the server and use the manager ID of the UI.

Best Regards
Leopold Knipp
Senior Support Specialist

GrahamRA
Posts:6
Joined: Wed Dec 09, 2020 12:46 pm

Re: Function not defined, requestFileTransfer

Post by GrahamRA »

I would note that the same Availablility seems to be stated for all the functions listed on the File functions page, including functions I've been using in the UI without issue (e.g. fileToString). I suggest the documentation needs an update.

3 posts • Page 1 of 1