Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 7th, 2004, 10:32 PM
Registered User
 
Join Date: May 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default DateTime Format Passing from C++ App to CR

Dear All,

I have found method to suppress the pop up of parameters by using the "Change Subreport Links", I link the parameter to "?@Parametername" ( the other option i see is @PM-Parametername ).

After I link the parameter I call the following code to pass the value to the main report ( Data type is date time ) :

I see that the date time being passed to those parameters indexes & the name of the parameter are correct, but the exported report ( text format ) does not have any records.

I use the cr designer for the same date time inputs & i see the result.

Can any one help me?

here's the codeL:
void CCrystalReport::setSPparam(int nth, const CString &in )
{

    CRPEParameterFieldInfo info;
    CRPEParameterFieldInfo *ptrInfo = &info;

    if(! ::PEGetNthParameterField(m_printJob->GetJobHandle(),
                          (WORD)nth,
                          (struct PEParameterFieldInfo *) &info) ) {
        throw new CCrystalException( m_printJob->GetErrorText() );
    }


    PEValueInfo valInfo;
    valInfo.StructSize=PE_SIZEOF_VALUE_INFO;
    valInfo.valueType = PE_VI_DATETIME;

    CString tmpStr = in;
    CString s;
    char tBuf[10];

    int liyear = atoi(tmpStr.Left (4));
    valInfo.viDateTime[0] = liyear;

    int limonth = atoi(tmpStr.Mid (5,2));
    valInfo.viDateTime[1] = limonth;

    int liday = atoi(tmpStr.Mid (8,2));
    valInfo.viDateTime[2] = liday;

    int liHr = atoi(tmpStr.Mid (11,2));
    valInfo.viDateTime[3] = liHr ;

    int liMin = atoi(tmpStr.Mid (14,2));
    valInfo.viDateTime[4] = liMin;

    int liSec = atoi(tmpStr.Mid (17,2));
    valInfo.viDateTime[5] = liSec;

    if (! ::PEConvertVInfoToPFInfo( &valInfo, &info.m_ValueType,

    info.m_CurrentValue ) ) {
        throw new CCrystalException( m_printJob->GetErrorText() );
    }

    info.m_DefaultValueSet=FALSE;
    info.m_CurrentValueSet=TRUE;

    if ( !m_printJob->SetNthParameterField( (short)nth, &info ) ) {
        throw new CCrystalException( m_printJob->GetErrorText() );
    }
}

void CCrystalReport::setSubReportSPparam(CRPEJob* p,int nth, const CString

&in )
{
    CRPEParameterFieldInfo info;

    int t = p->GetNParameterFields();

    if(! ::PEGetNthParameterField(p->GetJobHandle(),
                          (WORD)nth,
                          (struct PEParameterFieldInfo *) &info) ) {
        throw new CCrystalException( m_printJob->GetErrorText() );
    }


    PEValueInfo valInfo;
    valInfo.StructSize=PE_SIZEOF_VALUE_INFO;
    valInfo.valueType = info.m_ValueType ;

    if (valInfo.valueType == 4 )
        strcpy( valInfo.viString, in);
    else if (valInfo.valueType == 5 )
    {
        // Handle the DateTime type
        CString tmpStr = in;
        CString s;
        char tBuf[10];

        int liyear = atoi(tmpStr.Left (4));
        valInfo.viDateTime[0] = liyear;
        valInfo.viDate[0] = liyear;

        int limonth = atoi(tmpStr.Mid (5,2));
        valInfo.viDateTime[1] = limonth;
        valInfo.viDate[1] = limonth;

         int liday = atoi(tmpStr.Mid (8,2));
        valInfo.viDateTime[2] = liday;
        valInfo.viDate[2] = liday;

        int liHr = atoi(tmpStr.Mid (11,2));
        valInfo.viDateTime[3] = liHr ;
        valInfo.viTime[0] = liHr ;

        int liMin = atoi(tmpStr.Mid (14,2));
        valInfo.viDateTime[4] = liMin;
        valInfo.viTime[1] = liMin;

        int liSec = atoi(tmpStr.Mid (17,2));
        valInfo.viDateTime[5] = liSec;
        valInfo.viTime[2] = liSec;
    }

    if ( !p->SetNthParameterField( (short)nth, &info ) ) {
        throw new CCrystalException( p->GetErrorText() );
    }

}

Thanks & Regards
Sankar







Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert DateTime Format dnyanubhamare C# 2005 2 February 25th, 2008 09:06 AM
hi! datetime format question.. xkorakidis JSP Basics 0 January 10th, 2008 06:17 AM
Format datetime deb1980 ASP.NET 2.0 Basics 7 April 17th, 2007 12:35 AM
DateTime format quirks ADMystery ASP.NET 1.0 and 1.1 Professional 5 September 18th, 2006 06:02 AM
Passing CR Login info in a ASP.NET app. billbeecher@cox.net BOOK: Professional Crystal Reports for VS.NET 0 March 31st, 2005 10:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.