AutoQuery arguments specified at Compile Time

Were using AutoQuery to generate a page of SystemEvents

[Route("/System_Events")]
[AutoQueryViewer(
    IconUrl = "octicon:repo",
    Title = "System Events",
    DefaultFields = "Id,Time,What,Src,Dest,RestCal"
)]
public class System_Events : QueryDb<Command_History>{}

At Runtime we can query this using

http://localhost/System_Events?What=MQ

But I would like to have as part of your AutoQuery UI. Therefore I would like to configure this query at compile time to specify the What argument.

I want one class for each type of Event - (MQ, REST, DB)

E.G.

public class System_Events_MQ :QueryDb<Command_History>{}
public class System_Events_Rest:QueryDb<Command_History>{}
public class System_Events_DB:QueryDb<Command_History>{}

Each class would map to its own place in the AutoQueryUI. Q: How can I bake in the What=MQ into the System_Events_MQ class. I’ve looked at this for a while an have come up empty.

Thanks in advance for the assistance.

I did try this

[AutoQueryViewer(
    IconUrl = "octicon:repo",
    Title = "System Events",
    Description = "",
    DefaultSearchField = "What",
    DefaultSearchType = "=",
    DefaultSearchText = "MQ",
    DefaultFields = "Id,Time,What,Src,Dest,RestCall,Url:30,JsonLen,MsgDescribe:5000"
)]
public class System_Events_MQ : QueryDb<Command_History> { }

But the text MQ did NOT appear in the DefaultSearchText field in the UI. Not sure why. Bug?

Note: I am actually calling it with an INTO argument.

public class System_Events_MQ:QueryDb Command_History, Command_History_OverRide> { }

I omitted it in my examples to make it clearer.

Figured it out.

When I changed the AutoQueryViewer syntax to this.

[AutoQueryViewer(
IconUrl = “octicon:repo”,
Title = “System Events”,
Description = “”,
DefaultSearchText = “MQ”,
DefaultSearchField = “What”,
DefaultSearchType = “=”,
DefaultFields = “Id,Time,What,Src,Dest,RestCall,Url:30,JsonLen,MsgDescribe:5000”
)]

Moving the DefaultSearchText before the Field or Type fixed it. Not sure why

1 Like