cancel
Showing results for 
Search instead for 
Did you mean: 

Hello I am getting the error 'this field name is not known' when I am trying get any value from a view field in crystal reports 11 from VB .net 2010.

Former Member
0 Kudos

Hello I am getting the error 'this field name is not known' when I am trying get any value from a view field in crystal reports 11 from VB .net 2010.

I am trying to get value from a field name inside a formula. I tried both in Crystal syntax as well as in Basic Syntax.

I tried to give value in the formula text also in the VB .Net code. It takes only strings in the .Net code.

formula code in VB .Net

Dim x as date

If {@PI} = "PI" Then

    x = DateValue({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE})

else

    If IsNull({VIEW_GROUP_TOTALS.CH_OPEN_DATE}) Then

        x = DateValue({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE})

    else

        x = DateValue({VIEW_GROUP_TOTALS.CH_OPEN_DATE})

    End If

End If

formula = x

I tried using single quote like this DateValue("'{VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE}'") - tried all possibilities but in vein.

In crystal syntax i tried the following.

dateVar x:=CDate({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE});

If {@PI} = "PI" Then x = CDate({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE});

- I am getting the same error.

The error is

This field name is not known.

Details:errorKind

Error in File Case_Group_Manager

{69687C0B-2A67-406D-9E3B-CDD25E93A974}.rpt

Error in formula EntryDate:

'dateVar x:=CDate({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE});

'

This field name is not known.

Details: errorKind

Please help.

Thank you

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member205840
Active Contributor
0 Kudos

Hi Ravi,

In order to test this, can you place below in your report and see what values you are getting or you are getting field name is unknown.

If {@PI} = "PI" Then  CDate({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE});

Also, i see that you are not assigning field values properly in your if statement. Also check if you see any other values other date in this field.

dateVar x:=CDate({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE});

If {@PI} = "PI" Then x: = CDate({VIEW_GROUP_TOTALS.CH_PI_OPEN_DATE});

Thanks,

Sastry

Former Member
0 Kudos

hello Sastry, Thank you for the quick reply. It gave me syntax error.

Below is my Vb code for the basic syntax ...

Dim x as string

If {@PI} = "PI" Then

    x = {VIEW_ACCOMPLISHMENT_TOTALS.CH_KEY_DISPLAY} & "-PI"

Else

    If IsNull({VIEW_ACCOMPLISHMENT_TOTALS.CH_OPEN_DATE}) Then

        x = {VIEW_ACCOMPLISHMENT_TOTALS.CH_KEY_DISPLAY} & "-PI"

    Else

        x = {VIEW_ACCOMPLISHMENT_TOTALS.CH_KEY_DISPLAY}

    End If

End If

formula = x

- Thank you

Former Member
0 Kudos

Hello, what I found now is that the formula fails only if it is a datetime format. The data source is DB2.

I tried to convert into string by CSTR but it did not help.

The formula is not able to get this field value. This is the issue I am facing now.

Any help is appreciated. I am checking for null / value in the field.

Thanks again,

Rav