Very interesting idea. I'm assuming you want to do this in PSQuery/Query Manager...
I just created an ad-hoc query as a quick test. I WAS able to use a number as a default prompt-value and then use that prompt within an expression that performs a calculation. The prompt field type was Number, the field width was 2, and the default value was 10. The expression was Number 2.0, with a text of: 5+(:1). I used that expression as a field. Without entering anything else in the prompt, I ran the query. The result was 15.
I also tried creating a CASE-statement as the default value of a prompt, and then using that prompt within an expression. All that did was return the syntax of the CASE-statement. The statement itself didn't run.
So, this method would work to create defined values which could be embedded within expressions, or used in criteria, or as fields... as long as the defined value isn't complex. Fields and basic numbers work. Dates should as well, but you would have to pay close attention to the default-value syntax as well as the prompt field type and expression field type.
Overall, it would give you a way to easily update your defined constants simply by updating the prompts. That would be better than having to dig through the code every time a defined constant changed. But as always, PSQuery has limitations.
If anyone does find a way to use expressions as the default values of prompts, please let me know ASAP.
------------------------------
Scott Frey
Senior Data Analyst - Human Resource Information Systems
University of Colorado System
------------------------------
Message from the HEUG Marketplace:------------------------------
Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the
HEUG Marketplace.
------------------------------
Original Message:
Sent: 03-31-2026 05:11 PM
From: Alex White
Subject: Any way to set variables in expressions in PS query?
You might be able to leverage process parameters, as they are query-able. Sort of depends on the requirements, but works well when you have lists, such as academic programs/plans or item types.
------------------------------
Alex White CBAP
Senior Business Analyst
University of Wisconsin - Madison
------------------------------
Message from the HEUG Marketplace:
------------------------------
Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
Original Message:
Sent: 03-31-2026 04:48 PM
From: John Royal
Subject: Any way to set variables in expressions in PS query?
I'm probably just fantasizing here but is there anyway to hardcode a variable in an expression and reference it later? Or in a query and reference it in an expression? I have a really complex expression I have to update somewhat frequently, it would save me a lot of time to just declare them at the top of an expression and change them there.
Would the only way to accomplish what I'm thinking of be to set Prompts with default values, then reference the prompts in the expression?
Just thinking out loud after a long day, thanks,
John
------------------------------
John Royal
Program Manager II, Systems and Loans
Wake Forest University School of Medicine
------------------------------
Message from the HEUG Marketplace:
------------------------------
Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the HEUG Marketplace.
------------------------------