# Using SSRS's =Lookup in ignition

**URL:** <https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419>\
**Category:** Ignition\
**Tags:** scripting, reporting\
**Created:** [January 27, 2025, 11:56am UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419 "2025-01-27T11:56:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SMarcin](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@SMarcin](https://forum.inductiveautomation.com/u/SMarcin)\
**Post date:** [January 27, 2025, 11:56am UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/1 "2025-01-27T11:56:36Z")

</div>

Hello everyone.

I have an issue with porting SSRS's =Lookup function into ignition's reporting.

My SSRS's lookup function:  
`=Lookup("DAYSHRT" , Fields!Id.Value , Fields!DAYFULL.Value,"Timestamps")`

I pass "MND" as DAYSHRT and in return i get a full name of the week "Monday".

I need this to fill my column names with expressions where each column name will be a separate lookup with "MND", "TUESD" etc.

How do i approach this?  
I'm stuck in a loop of my own trials, errors and mistakes.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 27, 2025, 2:31pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/3 "2025-01-27T14:31:25Z")

</div>

> [@SMarcin](#):
>
> a separate lookup with "MND", "TUESD" etc.

Mon, Tue, Wed, Thu, Fri, Sat, Sun are the standard day of week abbreviations. I recommend that you use those as your users will be familiar with them and they are unambiguous - unless you're working in some other language?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 27, 2025, 4:30pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/4 "2025-01-27T16:30:55Z")

</div>

> [@SMarcin](#):
>
> I need this to fill my column names with expressions where each column name will be a separate lookup with "MND", "TUESD" etc.

You should rewrite your column names either in your data source directly (as in the SQL query or whatever other source) or if that truly isn't possible, use a script data source to rewrite the dataset headers once, using `system.dataset` scripting functions.

Using keychain expressions for this would be _possible_, but a maintenance nightmare.

---

<div class="post-metadata">

**Author:** ![SMarcin](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@SMarcin](https://forum.inductiveautomation.com/u/SMarcin)\
**Post date:** [January 27, 2025, 8:03pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/5 "2025-01-27T20:03:47Z")

</div>

This is somewhat close to what i need, I'm gonna sniff around.

After reading how i formatted my post, i've decided that i'm gonna rewrite it:

I need to have some script in each column of my header in my reporting table, so that column's value is based on script's outcome. For example:  
If i have value MND in first column of my header, this value should be passed to a script that looks up the translation table and returns a value based on currently selected language (the language part is done).

In SSRS each column header has a short lookup expression and it solves the problem. Here i worked around it by making a separate SQL Query for each column in Reporting-\>DATA tab -\>Data sources which works, but i find it disgusting compared how elegantly its solved in SSRS due to a lot of queries which differ only by the hard-coded searched value. I'd like to pin each header's value to one script that would handle all of the columns. To do that, i'd need to know: **how can i reference to a certain header row in my script?**  
I'm starting to think that this approach is impossible.

SSRS's header expression I've mentioned above:  
Header 1:  
`=Lookup("MND" , Fields!Id.Value , Fields!Translation.Value,"Translations")`  
Header 2:  
`=Lookup("TSD" , Fields!Id.Value , Fields!Translation.Value,"Translations")`  
etc.

Desired outcome visualised:

 ![SCRN](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/a/5a7cca985b512ff7d5203b0d267c639a6523fda4.png)

---

<div class="post-metadata">

**Author:** ![SMarcin](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@SMarcin](https://forum.inductiveautomation.com/u/SMarcin)\
**Post date:** [January 27, 2025, 8:08pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/6 "2025-01-27T20:08:09Z")

</div>

This was only used as a form of example so it would be easier to understand the issue, but you are right - I'am working with other languages, so thats why i need to use some form of Lookup based on current language.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 27, 2025, 8:24pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/7 "2025-01-27T20:24:08Z")

</div>

One option:  
Lean into Ignition's translation manager functionality.  
Put `MND`, `TSD`, etc into the translation manager, with translated values for each locale.  
I'm assuming you're accepting a locale string report parameter based on your two output examples.

Then, in a script data source, do something like this:

```python
weekdays = ["MND", "TSD", "WED"] # etc
translated_weekdays = [system.util.translate(weekday, data["locale"]) for weekday in weekdays]

data['weekdays'] = system.dataset.toDataSet(weekdays, [translated_weekdays])

```

To look up translations for the given inputs. Then in your actual report, just drop the `MND` value from your data sources into the table header and it'll automatically look up the first row and return it for you.

Another option would be to actually change the dataset headers, like I mentioned in my first post, but if you're already expecting this to work another way this is closer to what you're looking for.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 27, 2025, 8:26pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/8 "2025-01-27T20:26:13Z")

</div>

Can you not specify the locale to SSRS in the query and return the day of the week in the requested language automatically - probably using the "ddd" format. I've never heard of SSRS before but I'd imagine it should be possible.

---

<div class="post-metadata">

**Author:** ![SMarcin](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@SMarcin](https://forum.inductiveautomation.com/u/SMarcin)\
**Post date:** [January 27, 2025, 8:28pm UTC](https://forum.inductiveautomation.com/t/using-ssrss-lookup-in-ignition/101419/9 "2025-01-27T20:28:28Z")

</div>

Thats actually such a good idea!  
I'm gonna definitely give this approach a try, thank you very much!

I'm gonna respond to this once i get it working to share the solution.
