GETFILENAME

The GETFILENAME function returns the file name for a file adapter source or target of a specified card object. Without an argument, it returns the adapter command associated with the active source or destination.

You can use GETFILENAME in a map rule or component rule when you need the data file name.

Syntax:
GETFILENAME ( [ single-simple-object-name ] )
Meaning:
GETFILENAME ( [ card_for_which_resource_info_is_needed ] )
Returns:
A single text item

With an argument, GETFILENAME returns the file name for a file source or target of a specified card object. Without an argument, the function returns the source or destination name associated with the active source or destination.

Examples

  • GETFILENAME (OrderFile)

    If the card OrderFile is associated with the data file, install_dir\order.txt, GETFILENAME returns install_dir\order.txt.

    Suppose you want to run the map MyMap from a component rule on Record in your input to determine if input customer names are valid. MyMap has two inputs and one output. The first input is the customer name to be looked up. The second input is a lookup file. The output is a text item whose value is "valid" or "error".

    The name of the lookup file can vary; it must correspond to the name of the data file used as the source you are trying to validate. For example, if the data file name is c:\DATA.AAA, the lookup file name is c:\LOOKUP.AAA. If the data file name is c:\DATA.XYZ, the lookup file name is c:\LOOKUP.XYZ, and so on.

    You could use this component rule on Record to determine whether the customer name is valid:

    RUN ( "MyMap.mmc" , "-IE1S10" + CustomerName:$ + " -IF2 LOOKUP." + RIGHT ( GETFILENAME ( ) , 3 ) + " -OE1" ) = "VALID"

Related functions

  • GETDIRECTORY
  • GETRESOURCENAME

Feedback