CreoPlayer Runtime Error

  1. 4 years ago

    Joel_Eisenstat

    12 Mar 2020 User since 2016

    Good morning,
    A runtime error occurs for CreoPlayer but is fine for the simulator ; computed property
    get {
    return _formatdate;
    }
    set {
    _formatdate = value;
    Console.write(value);
    date.text = value[0...9];

    }
    TIA

  2. marco

    13 Mar 2020 Administrator User since 2016

    What is value?
    What are you trying to do with date.text = value[0...9]; ?

  3. Joel_Eisenstat

    13 Mar 2020 User since 2016

    Formatting the string - 2019-12-03 00:00:00

  4. marco

    13 Mar 2020 Administrator User since 2016

    So I don't understand what you are trying to achieve with date.text = value[0...9];.
    Please tell me what is the desired result.

  5. Joel_Eisenstat

    13 Mar 2020 User since 2016

    2019-12-03

  6. marco

    13 Mar 2020 Administrator User since 2016

    You are receiving that error because some times value is not a String but it is something else.
    Please try to Console.write(value.class); to better understand why/when this happens

  7. Joel_Eisenstat

    13 Mar 2020 User since 2016

    Ok will do that but in my testing I forced a string with String(value) and had the same results

  8. Joel_Eisenstat

    13 Mar 2020 User since 2016

    test <Console.write(value.class)> shows String, repeatable
    Of course I can only use this test with the simulator not CreoPlayer where the runtime error occurs.

  9. Joel_Eisenstat

    13 Mar 2020 User since 2016

    Forced a string for value (2019-12-03 00:00:00)
    var d = String(value)
    date.text = d[0...9];
    and ok for simulator, but a differant runtime error for CreoPlayer Also works for CreoPlayer in loading a list for initial record but not the second, which generates an error.

  10. marco

    14 Mar 2020 Administrator User since 2016

    Hi @Joel_Eisenstat it seems that at some point in CreoPlayer a value different from a String is sent to that method. var d = String(value) could not be sufficient if value cannot be converted to a String.
    What you can try to do is to add a check for a class type before the String transformation.
    I would write something like:

    if (value is String) {
       date.text = value[0...9];
    }
  11. Joel_Eisenstat

    14 Mar 2020 User since 2016

    OK, under what conditions would a value cannot be converted to a string ?

  12. marco

    14 Mar 2020 Administrator User since 2016

    Well, there are a lot of cases... for example from the first error message that you posted it seems that value was a CustomView. How can a CustomView object be converted to a String? This is not possibile.

  13. Joel_Eisenstat

    14 Mar 2020 User since 2016

    Ok I see that all objects cannot use String() but still cannot see why in CreoPlayer the CustomView45 doesn't follow through and use the computed property , whose value is a string .
    Anyways shut in for a few weeks, though not as strict as you have , so plenty of time to figure it out.

  14. Joel_Eisenstat

    15 Mar 2020 User since 2016

    Console.write(value.class); -----> anonymous closure , this gives the error
    Runtime Error
    Out of bounds error: second_index 9 beyond bounds 0...3
    What is anonymous closure ?

  15. Joel_Eisenstat

    16 Mar 2020 User since 2016

    It seems to be associated with a date value and not being able to be converted to a string by CreoPlayer thus creating an error for value [0...9]. Ok for the simulator if that helps you
    BTW - Hope all is well with the Creo team , all ok here but headed to lockdown shortly.

or Sign Up to reply!