Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

SSRS report multi select lookup based on temp table

(0) ShareShare
ReportReport
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 6,493 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 7,264 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 7,264 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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans