# Navigating to a Variable or a Function

* Users can make a selection in two ways:
  * Select: Select the variable or function.
  * Drill: Go further and select an instance of the variable or function. An instance provides a value to the variable or function.
* To select a variable or function, click the drop-down arrow of the field and click in the shaded area of the selected variable.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img1_clickintargetvalue.png" alt=""><figcaption></figcaption></figure>

* In this example, first a variable "strDate" is selected.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img3_clickvarorfunctiontext.png>" %}

* To drill down into a function, click on the text of the variable or function. \
  The instances of the variable or function are displayed. Each instance provides a value type to the variable or function.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img3_targetvariablefunctions.png>" %}

* To select the instance, click outside of the text within the shaded area.&#x20;
* To go back and not select an instance, click on the left arrow in the field displaying the variable.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img4_gobackarrowtargetvariablefunctions.png>" %}

* To see the illustration of navigating to a function or its instance, see [Static functions](/welcome/get-started/learn-langstack/basics-and-essentials/what-is-a-function/working-with-functions.md).
* There are two types of Source values entered in the Actions (to assign values to the Target variable for example):
  * Constant values: These are typed directly and on pressing Enter, these values display in a blue bubble.
  * Variable values: These are values assigned by navigating to functions or variables. When a variable's value is selected, it is called an Expression. It is displayed in a white bubble. The bubble is termed an Expression bubble.

## Examples

### Assigning function to a variable

To add the Now() function as Source value to update the variable “strDate” of data type DateTime, navigate by selecting: Functions>DateTime>CurrentDate(string).

* Select variable StrDate.
* Drill down into Functions.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2workingwithfunctions_img2_selectfunctions.png>" %}

* Drill down into DateTime.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2workingwithfunctions_img4_drillintodatetimefunction.png>" %}

* Select CurrentDate(string) function.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2workingwithfunctions_img6_selectcurrentdate.png>" %}

* The Expression bubble shows the expression Functions>DateTime>Now().

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2workingwithfunctions_img7_selecttodate.png>" %}

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2workingwithfunctions_img8_displayscurrentdatetodatetime.png>" %}

### Assigning variable to a variable

To assign the value in the variable “strNewDate” of data type string to another variable “strDate” of data type string, add the variable “strNewDate” as the Source value by navigating as Variables>strNewDate.

* Select the target variable "strDate".

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img3_clickvarorfunctiontext.png>" %}

* In the source, click on Variables

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img5_variabletovariable1.png>" %}

* Select the variable "strNewDate".

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img6_variabletovariable2.png>" %}

* The Expression bubble shows the expression strNewDate.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img7_variabletovariable3.png" alt=""><figcaption></figcaption></figure>

### Assigning constant values to variables

* To add constant values, type in the value and press Enter. \
  For example, to add the string “Welcome!” as a value to be updated to the Target variable “str”, type the text “Welcome!” and press Enter.
*

```
<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img9_constanttovariable2.png" alt=""><figcaption></figcaption></figure>
```

### Assigning constant values and expressions

#### *Constant Values and Expressions*

To add the Source as the text “Hello!” with a reference variable that contains a name, in the source:

* First type Hello and press Enter.&#x20;

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img10_constantandexpression1.png" alt=""><figcaption></figcaption></figure>

* Second, select Variables>name. (as shown in the image sequences below)

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img11_constantandexpression2.png>" %}

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img12_constantandexpression3.png>" %}

#### *Multiple variable values*

To add the Source as “CustID” through the variable “CustomerDetail” with a reference variable that contains a name, in the source:

* First, select Variables>CustID.&#x20;

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img14_multiplevariables1.png>" %}

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img15_multiplevariables2.png>" %}

* Next, add the variable referencing the name.

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img16_multiplevariables3.png>" %}

{% embed url="<https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img17_multiplevariables4.png>" %}

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_2/ch2navigatingtovariablefunction_img13_constantandexpression4.png" alt=""><figcaption></figcaption></figure>

### Reposition variables

The variables can be repositioned. To change the order from "result" "name" to "name" "result", select the variable "name" and drag it. It displays “Move Here” to show the place for repositioning.

![](/files/9ajJrIjsqt8yb6uPFD8E)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.langstack.com/welcome/get-started/learn-langstack/basics-and-essentials/navigating-to-a-variable-or-a-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
