1

How can I pass the current date from one PA to another in UniQuery? A colleague taught me the trick of having the date written by cron to a file and using a inline prompt to read it with <<F(HOLD,X.DATE.TODAY,1)>>, but that adds extra parts that can fail and I would rather keep it simple (aka one time the file didn't get updated, oops).

I basically need something like this.

AE VOC MY.PROCESS.TODAY
001: PA
002: MY.PROCESS ?????

To run my second PA with the current date.

AE VOC MY.PROCESS
001: PA
002: SELECT PERSON WITH PER.CHANGE.DATE EQ <<I2,Enter Date:>>

This does work, MY.PROCESS <<F(HOLD,X.DATE.TODAY,1)>>, but is there anyway I could pass the results using something more reliable like DATE() as the argument into the second paragraph?

Script Wolf
  • 106
  • 2
  • 12

2 Answers2

1

You will likely get answers saying "don't do that in a paragraph", and to some extent that's right - anything except for a simple list of commands can get complicated.

That said, the below works for me:

AE VOC MY.PROCESS
001: PA
002: CLEARPROMPTS
003: SELECT PERSON WITH PER.CHANGE.DATE EQ <<I2,Enter Date:>>

From: https://docs.rocketsoftware.com/nxt/gateway.dll/RKBnew20/unidata/v8.2.1/unidata_userguide_v821.pdf

I use the I option while testing: "The I and S options are similar to the C option. The In option prompts for text if n is not specified, and the Sn option passes the value of n to called paragraphs."

Also read the section just above that "Always prompting with an inline prompt", to explain why CLEARPROMPTS is needed. Without that, if you don't pass a parameter it will gladly use the last one provided.

[Edit: to provide BASIC option] Paragraphs are great for really simple things, and there's probably a way to finagle things. But it's a one-line basic program to get something working:

EXECUTE "MY.PROCESS ":OCONV(DATE(),"D4/")

Is there a hard requirement that MY.PROCESS.TODAY be a paragraph? If you compile and catalog this one-line program as BP MY.PROCESS.TODAY then it will work exactly as needed.

Ian McGowan
  • 3,461
  • 3
  • 18
  • 23
  • I don't think I explained that very well. The part I'm having trouble with is getting the constantly changing current date to be the answer to the second paragraph's prompt instead of something static. I'll fix the question to explain better. – Script Wolf Apr 04 '18 at 13:43
  • Not ideal but I think that just might work. Thanks Ian! – Script Wolf Apr 09 '18 at 14:45
1

You could also create a Vitrual Dictionary item that his today's date

ED DICT PERSON TODAYSDATE

I @DATE D2/ TODAY'S DATE 10L S

Then your select statement becomes:

SELECT PERSON WITH PER.CHANGE.DATE EQ TODAYSDATE

This admittedly will run slower than looking at a stored date as it is being calculated against each record queried rather than being stored. If PERSONS is a large file, this might not be a good idea.

PhilipZU2
  • 21
  • 4