Hello,
i have a date field and a checkbox and i want when we check tbe box, the date field move to a numeric field.
the date fiels is a criter for search and the user check on the box, the criter is not a date fiels but a numeric...
For example if the criter is 14-02-1996 when the box is checked the research must be concerned 1996 onlyI
sqlrpg
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: sqlrpg
Bind your PUI date field to a numeric RPG field. Bind your check box to an RPG indicator field. Then in the RPG code, you can check if the check box was selected (by checking the indicator) and if so, you can include the date field in your selection criteria.
Is that what you are asking?
Code: Select all
criteria = 0;
if CheckBoxField = *on;
criteria = TheDateField;
endif;
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
Re: sqlrpg
Yes Scott, it's almost that but in my case I have one date of birth field:
If DateNaiss <>d'0001-01-01';
Query += ' and PERSON_DATE_NAISSANCE = '
+quote+%char(DateNaiss)+quote;
Endif;
So in this case How to get the year of birth in order to search over this year alone and not the date?
If DateNaiss <>d'0001-01-01';
Query += ' and PERSON_DATE_NAISSANCE = '
+quote+%char(DateNaiss)+quote;
Endif;
So in this case How to get the year of birth in order to search over this year alone and not the date?
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: sqlrpg
RPG has a built-in function named %SUBDT that can extract a portion of a date field.
More info can be found here:
http://pic.dhe.ibm.com/infocenter/iseri ... htm#bbsubd
Code: Select all
YearNaiss = %SUBDT(DateNaiss: *YEARS);
http://pic.dhe.ibm.com/infocenter/iseri ... htm#bbsubd
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
Re: sqlrpg
YES... it works now thanks scott
Who is online
Users browsing this forum: No registered users and 2 guests