Your request is vague, but this simple example illustrates my suggested approach.
Names Default to Here( 1 );
// dialog to ask user for parameter and value for query
dialog = New Window( "Custom Query", << Modal,
Panel Box( "Parameter and Value",
Line Up Box( N Col( 2 ),
Text Box( "Enter Parameter Name" ),
nameTEB = Text Edit Box( "HighestLevelOrder_Material" ),
Text Box( "Enter Parameter Value" ),
valueTEB = Text Edit Box( "06C3020" )
)
),
H List Box(
Button Box( "OK",
name = nameTEB << Get Text;
value = valueTEB << Get Text;
),
Button Box( "Cancel" )
)
);
If( dialog["Button"] != 1, Throw( "User cancelled" ) );
// modify query by splicing name and value into second argument
Substitute(
"SELECT * FROM [dbo].[vw_TechOps_DashboardData_MB56TopDowns] WHERE dbo.vw_TechOps_DashboardData_MB56TopDowns.NNNNN = 'VVVVV'",
"NNNNN", name,
"VVVVV", value
);
Open Database(
"Description=Tracking Test5;DRIVER=SQL Server;SERVER=CWA565656P\SQLEXPRESS;UID=SVC-Tech-R;PWD=TestPW;APP=JMP;WSID=ADDDE1L5HS573;DATABASE=Tracking_and_Trending;",
query
);