# Fill variable with value from interface/lte/cellular/Access Technology ... possible ?

**URL:** <https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530>\
**Category:** Scripting\
**Created:** [March 10, 2021, 4:03pm UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530 "2021-03-10T16:03:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![roe1974](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/roe1974/32/59426_2.png) [@roe1974](https://forum.mikrotik.com/u/roe1974)\
**Post date:** [March 10, 2021, 4:03pm UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/1 "2021-03-10T16:03:12Z")

</div>

Hi

Is it possible to fill a variable with the value of “interface/lte/cellular/Access Technology” in a LtAP Router for example ?  
If yes, wath are the possible values like: LTE (CA2), Evolved 3G …etc.

thx for help, Richard

---

<div class="post-metadata">

**Author:** ![SiB](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/sib/32/1144_2.png) [@SiB](https://forum.mikrotik.com/u/SiB)\
**Post date:** [March 10, 2021, 9:03pm UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/2 "2021-03-10T21:03:05Z")

</div>

> [@](#):
>
> Is it possible to fill a variable with the value of "interface/lte/cellular/Access Technology" in a LtAP Router for example ?

What you mean ?

> If yes, wath are the possible values like: LTE (CA2), Evolved 3G ...etc.

Evolved 3G (LTE) -\> you have a LTE connection.  
LTE (CA2) -\> you have a LTE connection with 2 Bands/Frequency as Carrier Aggregation.

---

<div class="post-metadata">

**Author:** ![roe1974](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/roe1974/32/59426_2.png) [@roe1974](https://forum.mikrotik.com/u/roe1974)\
**Post date:** [March 11, 2021, 10:40am UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/3 "2021-03-11T10:40:10Z")

</div>

In a script i want to put the actual value of “Access Techbnolgy” in a global variable … is this possible ?

---

<div class="post-metadata">

**Author:** ![SiB](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/sib/32/1144_2.png) [@SiB](https://forum.mikrotik.com/u/SiB)\
**Post date:** [March 12, 2021, 11:11am UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/4 "2021-03-12T11:11:02Z")

</div>

Check first line of code of this:  
Watch LTE parameters: [http://forum.mikrotik.com/t/r11e-lte6-2ca-not-staying-connected/136004/22](http://forum.mikrotik.com/t/r11e-lte6-2ca-not-staying-connected/136004/22)

---

<div class="post-metadata">

**Author:** ![roe1974](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/roe1974/32/59426_2.png) [@roe1974](https://forum.mikrotik.com/u/roe1974)\
**Post date:** [March 12, 2021, 1:09pm UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/5 "2021-03-12T13:09:00Z")

</div>

sorry i can’t figure it out … how must the line look like ? 😉

---

<div class="post-metadata">

**Author:** ![SiB](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/sib/32/1144_2.png) [@SiB](https://forum.mikrotik.com/u/SiB)\
**Post date:** [March 19, 2021, 2:31pm UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/6 "2021-03-19T14:31:44Z")

</div>

In terminal:  
RouterOS v6: put ([interface lte info lte1 once as-value]-\>“access-technology”)  
RouterOS v7: put ([interface/lte/monitor lte1 once as-value]-\>“access-technology”)

and create a global variable for ros6:

```plaintext
global SiB_MyLTEAccTech ([/interface lte info lte1 once as-value]->"access-technology") ;

```

---

<div class="post-metadata">

**Author:** ![LaZyLion](https://forum.mikrotik.com/letter_avatar/lazylion/32/6_449c533f586939b6e5f246632a46421f.png) [@LaZyLion](https://forum.mikrotik.com/u/LaZyLion)\
**Post date:** [April 5, 2023, 7:19pm UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/7 "2023-04-05T19:19:40Z")

</div>

Thank you Sib! This had been driving me crazy for over an hour.

For future me googling:

```plaintext
interface/lte/monitor lte1 once

```

will get you the list of available item names (called keys) and values.

To extract a specific key:

```plaintext
:put ([interface/lte/monitor lte1 once as-value]->"imei")

```

or

```plaintext
:local lteStatus ([interface/lte/monitor lte1 once as-value]->"status"); :put "Lte is $lteStatus";

```

When you using an “as-value” command from the help docs or forum posts, make sure the “value” is in the list.  
On my chateaux 5G running v7.8, “access-technology” is not one of the available items.

---

<div class="post-metadata">

**Author:** ![rextended](https://forum.mikrotik.com/user_avatar/forum.mikrotik.com/rextended/32/67729_2.png) [@rextended](https://forum.mikrotik.com/u/rextended)\
**Post date:** [April 6, 2023, 8:51am UTC](https://forum.mikrotik.com/t/fill-variable-with-value-from-interface-lte-cellular-access-technology-possible/147530/8 "2023-04-06T08:51:35Z")

</div>

Better to do something like this, works regardless if it's v6 or v7.  
{  
:local cmdname "info" ; :if ([/system resource get version] ~ "^7\.") do={:set cmdname "monitor"}  
:local cmdstring ":return [/interface lte $cmdname ([find]-\>0) once as-value]"  
:local ltemon [[:parse $cmdstring]]

# mode 1

:put "IMEI is $($ltemon-\>"imei")"  
:put "Current Operator is $($ltemon-\>"current-operator")"

# mode 2, if the values are readed multipe times:

:local lteimei ($ltemon-\>"imei")  
:local lteoperator ($ltemon-\>"current-operator")  
:put "IMEI is $lteimei"  
:put "Current Operator is $lteoperator and the IMEI still $lteimei"  
}
