Jump to content
We've recently updated our Privacy Statement, available here ×

jakehngo

Members
  • Posts

    5
  • Joined

  • Last visited

jakehngo's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I have member IDs and their date of births so I need to generate this final structure: member ID + First Capital letter of birth month +2 digit day of birth member ID: 123456 DOB: 6/7/2011 final result: 123456J07 here are the fields in my Ireport: member ID: $F{localId} Expression Class: (java.lang.String) DOB: $F{person}.getDob() Expression Class:(java.lang.string) Patttern: MM/dd/yyyy I am having issues with the cast to string error so can anyone help create the right code? here is my code below: CONCATENATE($F{localId},LEFT(new SimpleDateFormat("MM", Locale.ENGLISH).format($F{person}.getDob())),new SimpleDateFormat("dd").format($F{person}.getDob())) Thanks for any help.
  2. I am newbie so here is my code: CONCATENATE($F{localId},LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format($F{person}.getDob())),new SimpleDateFormat("dd").format($F{person}.getDob())) what I am trying to achieve: LOCALID = 410079 DOB = 6/7/2001 Result: LOCALID + CAPITAL LETTER OF BIRTH MONTH + 2 DIGIT DAY OF BIRTH: 410079J07 ERRORS: error which I can't figure out. Any help would be greatly appreciated. Errors were encountered when compiling report expressions class file: 1. Cannot cast from String to Date value = (java.util.Date)(((java.text.DateFormat)parameter_shortDateFormat.getValue()).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob())); <------------------------------------------------------------------------------------------------------------------------------------------------------------> 2. The method LEFT(String) is undefined for the type EMCSD45EMAIL45RPT_1503939973151_930988 value = (java.lang.String)(CONCATENATE(((java.lang.String)field_localId.getValue()),LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob())),new SimpleDateFormat("dd").format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob()))); <--> 3. Cannot cast from String to Date value = (java.util.Date)(((java.text.DateFormat)parameter_shortDateFormat.getValue()).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getOldValue()).getDob())); <---------------------------------------------------------------------------------------------------------------------------------------------------------------> 4. The method LEFT(String) is undefined for the type EMCSD45EMAIL45RPT_1503939973151_930988 value = (java.lang.String)(CONCATENATE(((java.lang.String)field_localId.getOldValue()),LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getOldValue()).getDob())),new SimpleDateFormat("dd").format(((com.x2dev.sis.model.beans.SisPerson)field_person.getOldValue()).getDob()))); <--> 5. Cannot cast from String to Date value = (java.util.Date)(((java.text.DateFormat)parameter_shortDateFormat.getValue()).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob())); <------------------------------------------------------------------------------------------------------------------------------------------------------------> 6. The method LEFT(String) is undefined for the type EMCSD45EMAIL45RPT_1503939973151_930988 value = (java.lang.String)(CONCATENATE(((java.lang.String)field_localId.getValue()),LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob())),new SimpleDateFormat("dd").format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob()))); <--> 6 errors
  3. Hi hozawa, I am using your suggestion and here is my code: CONCATENATE($F{localId},LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format($F{person}.getDob())),new SimpleDateFormat("dd").format($F{person}.getDob())) but I getting this error message: Errors were encountered when compiling report expressions class file: 1. The method LEFT(String) is undefined for the type EMCSD45EMAIL45RPT_1501781853484_759547 value = (java.lang.String)(CONCATENATE(((java.lang.String)field_localId.getValue()),LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob())),new SimpleDateFormat("dd").format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob()))); <--> 2. The method LEFT(String) is undefined for the type EMCSD45EMAIL45RPT_1501781853484_759547 value = (java.lang.String)(CONCATENATE(((java.lang.String)field_localId.getOldValue()),LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getOldValue()).getDob())),new SimpleDateFormat("dd").format(((com.x2dev.sis.model.beans.SisPerson)field_person.getOldValue()).getDob()))); <--> 3. The method LEFT(String) is undefined for the type EMCSD45EMAIL45RPT_1501781853484_759547 value = (java.lang.String)(CONCATENATE(((java.lang.String)field_localId.getValue()),LEFT(new SimpleDateFormat("MMM", Locale.ENGLISH).format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob())),new SimpleDateFormat("dd").format(((com.x2dev.sis.model.beans.SisPerson)field_person.getValue()).getDob()))); <--> 3 errors
  4. thanks for the help but I am having no luck still. Below are my fields and the expressions in how to get the field so not sure how to implement these fields into your code. Thanks STUDENTID= $F{localId}------this pulls in the student ids $P{shortDateFormat}.format($F{person}.getDob())-------- this formats and pulls in my dob field to show 1/5/2006
  5. I have a student IDs and their date of births so I need to generate this final structure: StudentID(First Capital letter of birth month) and 2 digit day of birth: so student ID: 123456 student's DOB: 6/7/2011 here is what I want to see in the end: 123456J07 Thanks.
×
×
  • Create New...