AX2354

GetCurrentValue function

Returns information about the current filter context applied to the file, for either multipass processing or for a temporary sheet filter.

Temporary filters supported by this function include:

  • Sheet filters applied by use of the Quick Filter feature.
  • Sheet filters applied by use of a GetDocumentHyperlink URL.

This function is most commonly used for report titles and headers, so that the information updates dynamically when different filters are applied to the file.

Syntax

GetCurrentValue("ColumnNameorCode")

The valid entries for ColumnNameorCode depends on whether you are using the function in conjunction with multipass processing or with a temporary sheet filter.

Multipass processing

Value Description

Blank

If the parameter is left blank (open parentheses), the function returns the item being processed for the current pass. For example, if the multipass process is by department, then the function returns the department code for the current pass.

ColumnName

You can specify any column listed as a Source Column for the multipass process, and the function returns the value in that column, for the current pass. You can also specify columns that are listed only in the Group By and Sort By settings for the multipass process, but in this case no values can be returned for standard (non-multipass) processing. See GetCurrentValue behavior during non-multipass processing for more information.

For example, if the multipass process is by department, and you specify DEPT.VP as the column name, then the function returns the VP of the department for the current pass.

You can use fully qualified Table.Column syntax to specify the column, or you can use column-only syntax.

PassNumber

You can enter the keyword PassNumber to return the number of the current pass in the context of the overall multipass operation. For example, if the multipass process has 10 items to process, and the current item is the fifth item to be processed, the function returns 5.

Filter

You can enter the keyword Filter to return the full filter criteria statement being applied for the current pass. For example, this would return Dept.Region='West' when processing by Dept.Region and the current pass is for the West region.

Table

You can enter the keyword Table to return the table being used for the multipass process. For example, this would return Dept when processing by Dept.Region.

Column

You can enter the keyword Column to return the column being used to determine the list of values for the multipass process. For example, this would return Region when processing by Region.

When using the Column keyword, an optional Boolean parameter is available to specify whether to return just the column name or the fully qualified column name. By default, this parameter is False, which means the column name is returned. To return the fully qualified column name, specify True. For example: GetCurrentValue("Column",True) to return Dept.Region instead of just Region.

Temporary sheet filter

Value Description

QuickFilter

You can enter the keyword QuickFilter to return the filter criteria statement that is being applied by a temporary sheet filter. For example, if the sheet filter uses the filter criteria statement Dept.VP='Jones', that value is returned. If no temporary sheet filter is currently applied to the file, the function returns None.

NOTE: The prior version of this keyword is Temp_Filter_Value.

Temp_Filter_Key

You can enter the keyword Temp_Filter_Key to return the table or table type that is being used as the "key" for a temporary sheet filter. For example, if the filter uses the table type GL, that table type name is returned. If no temporary sheet filter is currently applied to the file, the function returns None.

All non-numeric entries must be placed in double quotation marks, unless you are using cell references to reference the text held in another cell.

Remarks

  • The return values for multipass processing and temporary sheet filters are mutually exclusive. The codes used for multipass processing do not recognize temporary sheet filters, and the codes used for temporary sheet filters do not recognize multipass processing. The function cannot be constructed in a way to return a filter value in both contexts.
  • When using the file processing type of Save Data in Batches, the only valid use of GetCurrentValue is to return the pass number. The other options do not apply in this context and will not return data.
  • GetCurrentValue is a non-volatile function.

Multipass examples

=GetCurrentValue()

This example returns the value of the current item being processed. For example, "Jones" if processing by DEPT.VP.

=GetCurrentValue("DEPT.VP")

This example returns the value in the DEPT.VP column for the current item being processed.

The difference between this example and the first one is that DEPT.VP does not have to be the column that defines the multipass list of items. For example, you may be processing by departments, but you have included DEPT.VP as an additional source column. As each department is processed, this example returns the name of the VP associated with that department.

Note that you could accomplish the same result by passing the current item value into GetData: =GetData("vp","dept="&GetCurrentValue()&"","dept")

=GetCurrentValue("PassNumber")

This example returns the number of the current pass. For example, "5" if the current pass is the fifth pass of the process. If the multipass process has 10 passes, this function will return 1-10 for each successive pass.

=GetCurrentValue("Filter")

This example returns the filter being applied for the current pass. For example, "Dept.Region='West'".

Temporary sheet filter examples

=GetCurrentValue("QuickFilter")

This example returns the filter criteria statement of the temporary sheet filter applied by the Quick Filter feature or GetDocumentHyperlink. For example: DEPT.Region='West'.

=GetCurrentValue("Temp_Filter_Key")

This example returns the table or table type that the temporary sheet filter applies to. For example: DEPT.

GetCurrentValue behavior during non-multipass processing

Although the primary intent of the GetCurrentValue function is to return information during multipass processing, you can configure the multipass settings so that the function also returns relevant values when using non-multipass processing (Process File). This applies when using GetCurrentValue with open parentheses or with a source column name.

The top of the File Processing Control Sheet has a section to define source columns and their current value defaults. For each source column listed in the top row, you can define a corresponding current value default in the bottom row. For example:

In this example, when using multipass processing, GetCurrentValue("DEPT.VP") returns the name of the VP currently being processed. When using non-multipass processing, the same function returns the text "All VPs". If the default value was left blank, then the function would return nothing (blank) during non-multipass processing.

You can define a default value for each source column as desired, or leave it blank to return blank.

If you use the GetCurrentValue function with open parentheses—GetCurrentValue()—then a value will only be returned during non-multipass processing if the Group By column is also listed as a source column (this happens automatically when using basic mode multipass settings), and the source column has a default value defined on the control sheet. Otherwise, the open parentheses function returns nothing during non-multipass processing.

When no file processing is occurring, using open parentheses or a column name returns the default values if defined; otherwise the function returns blank.

NOTES:  

  • You must use the File Processing Control Sheet if you want to define current value defaults for your source columns. The File Processing pane does not have a section to define these values.

  • The other options for GetCurrentValue are only intended to return values during multipass processing. This applies to the keywords PassNumber, Filter, Table, and Column. All of these options return blank when multipass processing is not occurring, except for PassNumber. PassNumber returns 0 if no processing is occurring, and 1 when non-multipass processing is occurring.