Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / SSRS report multi sele...
Finance forum
Suggested answer

SSRS report multi select lookup based on temp table

Posted on by 768
Hello,
 
I'm trying to create a multi lookup SSRS parameter and I have found an article explaining how to do that
 
 
it works like a charm when the lookup query is based on the regular table but I need it ti be based on the TEMPDB table and can't achieve this.
 
I tried this but with no result
 
 

Method: postRun

/// <summary>
/// Implements the functionality that is supposed to execute after run.
/// </summary>
public void postRun()
{
this.sampleTableIdLookup();
}

Method: sampleTableIdLookup

/// <summary>
/// Creates a SampleTable id lookup.
/// </summary>
public void sampleTableIdLookup()
{
 
TableTmp tableTmp;
 
tableTmp.id = 1;
tableTmp.insert();
 
tableTmp.id = 2;
tableTmp.insert();
 

Query query = new Query();
query.adddatasource(tablenum(tableTmp));
query.datasourcetable(tablenum(tableTmp)).addselectionfield(fieldnum(tableTmp,ID));
 
QueryRun qr = new QueryRun(query);
qr.setcursor(tableTmp);

TableId multiSelectTableNum = tableNum(tableTmp);
container selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(tableTmp, Id))];
SysLookupMultiSelectCtrl::constructWithQueryRun(this.dialog().dialogForm().formRun(), idField.control(), qr, false, selectedFields);
}
 
Lookup on the parameter form stays empty. Maybe anyone did smth like that before? Any help will be much appreciated
 
Thank you.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,169 Super User 2024 Season 2 on at
    SSRS report multi select lookup based on temp table
    Hi,
     
    Did you try to reset usage data (clear cache)?
     
    Thanks,
    Waed Ayyad.
  • dark_knight Profile Picture
    dark_knight 768 on at
    SSRS report multi select lookup based on temp table
    Hello,
     
    Thank. I also pasted the code. I do exactly what is done in standard classes as you can see and this doesn't work. I fill up temptable, then set cursor to this tmp buffer. NO result. Lookup is empty.
  • dark_knight Profile Picture
    dark_knight 768 on at
    SSRS report multi select lookup based on temp table
    Hello,
     
    Thank you for your answers. Yes, I have checked multiple standard classes and they do exactly what I do. they fill up temp table. Then set cursor to temp table buffer but for me this doesn't work.
  • Hana Xue Profile Picture
    Hana Xue Microsoft Employee on at
    SSRS report multi select lookup based on temp table
    Hi,
    Your link opened abnormally, so we can't view it. You can check if the links below are useful.
    jonesd365.blogspot.com
    dynamicsgate.com
    Best Regards,
    Hana
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 6,882 Super User 2024 Season 2 on at
    SSRS report multi select lookup based on temp table
    Hi Dark knight,

    I also just saw a standard class that uses "SysLookupMultiSelectCtrl::constructWithQueryRun" and also uses a tmp table.
    This method "companyLookup" gets called from postRun method 

    So you can check this standard class and see if it helps


    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 6,882 Super User 2024 Season 2 on at
    SSRS report multi select lookup based on temp table
    Hi Dark knight,

    The link you provided is not working for me.

    you could follow the following links in general for multi select (check if they help)
    https://d365fotechnicalblog.blogspot.com/2022/06/create-multi-selection-lookup-in-d365fo_5.html?m=1
    https://community.dynamics.com/blogs/post/?postid=1c4642c9-19be-43aa-847a-b396252f90f6
    https://msdaxter.wordpress.com/2018/04/12/create-a-multiselect-lookup-control-on-a-form/

    but you will need this line of code as an additional thing:
    sysTableLookup.parmTmpBuffer(YoutTmpTable);

    Here's another link that shows how to parmTmpBuffer (but this one is not for multi select)
    https://robscode.onl/x-lookup-on-temp-table-on-form-control-2/

    I'm not sure if it's doable as i didn't try it, but try to combine the links and see if you could make it working

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans