Hi,
How do you get this “#PROMPT(‘Field Name:’,FIELD),%AField,REQ,UNIQUE,DEFAULT(‘’)” to allow you to select the Date and Time from SQL Designed date Group. - Field inside the Group
IOW - I designed a template to select the fields from the database but the fields used for SQL to make up date time is in a group and when you select it or press the button to select the CSRH:RequestedDate_DATE shows and you can select it and Compile but compiler complains because
FIELD SELECTED = CSRH:RequestedDate_DATE and output to source from the template
BUT SHOULD BE IN CODE = CSRH:RequestedDate_GROUP.RequestedDate_DATE
Please advise?
Hi Marius,
Can you post your generated table definition?
Here’s an example from one of my tables.
Job FILE,DRIVER('MSSQL'),OWNER(GBL:Owner),NAME('DBO.Job'),PRE(JOB),BINDABLE,THREAD !Job
Record RECORD,PRE()
BidDateTime STRING(8) !Bid Date and Time
BidDateGrp GROUP,OVER(BidDateTime) !Record Change Date/Time Group
BidDate DATE !Date of Record Change
BidTime TIME !Time of Record Change
END !
I reference the BidDate field in code using JOB:BidDate and it works fine.
Rick ,
Yes now I go i bit further;
Now I create a template that compares whether the entries were changed on JobBefore AND JobAfter.
Global Declarations in the procedure the template is used [5080]
JobBefore LIKE(JOB:Record),THREAD
JobAfter LIKE(JOB:Record),THREAD
The template adds code to .init in the procedure [5800]
JobBefore :Record :=: JOB:Record
TakeAccecpted
CASE ACCEPTED()
OF ?OK
JobAfter:Record :=: JOB:Record
also then in .kill [6800]
IF JobBefore.JOB:BidDate <> JobAfter.JOB:BidDate
!!!DO SOMETHING
NOW THIS DOES NOT WORK.
It must be changed to include the group definition and also to call in the source.
It must be IF jobBefore.BidDateGrp.BidDate
Hope this makes more sense. Now I do not see how I can get the template to include the Group when you select the field from the pick button in the template or maybe I am doing something wrong with my declarations?
Looking at the dictionary symbols, I don’t know there is a way to do this.
A simple but not very elegant way is to use two prompts in your template. Put the field in the first like you are doing now and the optional put the qualifying group field in the other one. The in the template, if the qualifying group is populated build your comparison statement accordingly.
You can use %FieldID to get the name of your field without the prefix.
Something along these lines
#FIX(%Field,%AField)
#IF(%AFieldModifier<>'')
IF JobBefore.%AFieldModifier.%FieldID <> JobAfter.%AFieldModifier.%FieldID
#ELSE
IF JobBefore.%FieldID <> JobAfter.%FieldID
#END