You need to sign in to do that
Don't have an account?
Retrieve Data matched with date in object
I would like to retrieve data selected using the calender.
I still can't get the stored data.
I appreciate if anyone could help with this issue.
There was no error either with Visual force, Classes( 2 Classes)
(Visual Force is as follows)
Other parts except the following are abbreviated.
-----------------abbreviation------------------
<apex:inputfield value="{!task.POP_UPReceiptDateTime__c}">
<apex:actionSupport event="onchange" action="{!intervalCounter}" rerender="renderPanel" />
</apex:inputfield>
----------------abbreviation------------------
(1st one of the Classes is as below)
public with sharing class AAA {
public List<ABC_T_PopUpReceipt__c> popupreceipt { get; set; }
public ABC_T_PopUpReceipt__c createtime { get; set; }
public datetime mstDatetime { get; set; }
Integer count = 0;
/////Default Constructor
public AAA() {
mstDatetime = Datetime.now();
createtime = new ABC_T_PopUpReceipt__c();
}
public void init(){
initObjects();
}
public void initObjects(){
popupreceipt = new List<ABC_T_PopUpReceipt__c>();
setobject();
}
public void setObject(){
popupreceipt = AAADBAccess.getDatafromDBAccess();
}
public ABC_T_PopUpReceipt__c getTask() {
return createtime;
}
public void setTask(ABC_T_PopUpReceipt__c a) {
mstDatetime = a.POP_UPReceiptDateTime__c;
}
public void reload() {
init();
}
public PageReference intervalCounter() {
count++;
reload();
return null;
}
public Integer getCount() {
return count;
}
}
(2nd one of the Classes is as below)
*This is to be called by the first one
public with sharing class AAADBAccess {
public static List<ABC_T_PopUpReceipt__c__c> getDatafromDBAccess()
{
Datetime kakuninbi = Datetime.now();
List<ABC_T_PopUpReceipt__c__c> jyuryoukakunin = new List<ABC_T_PopUpReceipt__c__c>();
jyuryoukakunin = [select Id, OwnerId, IsDeleted, Name, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp,
POP_UPReceiptDateTime__c,kisyou_id__c,kisyou_id__r.Title__c,user_id__c
from ABC_T_PopUpReceipt__c__c
where POP_UPReceiptDateTime__c = : kakuninbi
order by POP_UPReceiptDateTime__c desc];
if (kisyoukeihou.size()==1)
return jyuryoukakunin;
else
return null;
}
}
These lines in your query:
seem at odds with each other. You are querying all records where the POP_UPReceiptDateTime is equal to System.now(), and then asking for them in a particular order. Further, as System.now() returns a datetime, you will only find items from the calendar that match to the millisecond.
Can you explain a little more about what you are actually trying to achieve?
Dear bob buzzard
Thank you for your reply.
What I'm trying to do is retrieve data matched on date between selected date ( <apex:inputfield value="{!task.POP_UPReceiptDateTime__c}"> ) and POP_UPReceiptDateTime__c of WXS_T_PopUpReceipt__c.
where the data is stored.
Thanks
Mori
The information I posted a few hours ago was not enough.
The data type of POP_UPReceiptDateTime__c is currently "Datetime".
I assume the value from the field <apex:inputfield value="{!task.POP_UPReceiptDateTime__c}"> also have "time".
(The date selected on the calender)
I would like to get all records which have Year&Month&Day matched
Time is not needed.
Is there any time-drop function available from APEX?
Sorry, it sounds complicated.
Mori