LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Changing Field Types

    Employee
    Posted 07-31-2012 12:12

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Kevinpbarry

    I have successfully in the past change field types from non-string to string. Now I was wondering why the same approach is not working for date fields. I pulled in an excel sheet and I have a date field that pulled in as Unicode. I am trying to compare it to another date field that has bdate as the type. Its giving me a "parameter 2 to '>' operator is not compatible: unicode" error. When I change the unicode field to be a date field i.e. Created.date() I get a different Error, "Single parameter must be either a datetime or a numeric type, not a 'unicode'"

    Any assistance in changing field types would be great.

    Thanks


  • 2.  RE: Changing Field Types

    Employee
    Posted 07-31-2012 22:46

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    You are on the correct track, but the date() function needs TWO parameters, the string to be converted, and the format that the expected data will be in:

    cdate=date(str(Created),"CCYY-MM-DD") #must use the correct date formatting here

    In BRE, if you place the cursor on the word "date" above and hit F1, it will bring up a long list of various formatting options available.