Runtime error

  1. 5 years ago

    Joel_Eisenstat

    26 Dec 2018 User since 2016

    Good afternoon,
    rs = TableView"\(table)".dataSet; // table = 1
    Runtime Error
    Unable to find dataSet into class String
    Anyway around this ?
    Likely a simple solution but turkey coma is having its effect.
    Thanks

  2. marco

    26 Dec 2018 Administrator User since 2016

    Really don't understand what you are trying to do... the error is right, you are trying yo ask for dataSet to a String in this example.

  3. Joel_Eisenstat

    27 Dec 2018 User since 2016

    string interpolation for TableView1 --> loading tableviews,

  4. Joel_Eisenstat

    27 Dec 2018 User since 2016

    I have 3 TableViews ( 1,2,3 ) which are loaded in loop with rs = Tableview(x).dataset , for loading each TableView where x is a variable - table = 1,2 or 3. Not clear how Gravity interprets the dot notation TableView1.dataSet
    vs TableView(x).dataSet

  5. Joel_Eisenstat

    27 Dec 2018 User since 2016

    Of course I had the statement backwards ;
    TableView"\(table)".dataSet = rs; which still has a an error
    Semantic Error
    Wrong assignment expression.

  6. marco

    29 Dec 2018 Administrator User since 2016

    I am really sorry @Joel_Eisenstat but I still do not understand what you are trying to do...

  7. Joel_Eisenstat

    29 Dec 2018 User since 2016

    It is likely simple but in another area ( building a calendar control) a loop is required to populate calendar cells - button objects . I am attempting to name the button object using a variable - for example C7 with C"(i)" where i = 7. My previous IDE this was done as C[i] but I cannot seem to find my way with gravity.

  8. marco

    31 Dec 2018 Administrator User since 2016
    for (var i in 1...10) {
       var name = "C" + i;
       Console.write(name);
    }

    result is:
    C1
    C2
    C3
    C4
    C5
    C6
    C7
    C8
    C9
    C10

  9. Joel_Eisenstat

    31 Dec 2018 User since 2016

    Thanks Marco but still obtaining error for ;

    //highlight todays date
    var dd = (day + offset) - 1; // formula for todays cell
    var todaycolour = Color.red;
    var c = "C" + dd; // dd = 36
    c.backgroundColor = todaycolour; // c = C36
    Runtime Error
    Unable to find backgroundColor into class String

  10. marco

    2 Jan 2019 Administrator User since 2016

    @Joel_Eisenstat C36 is not a color. If you want a string to be used as a Color then it needs to be a hexadecimal string 6 characters long (or 8 characters if you need to specify the opacity). For example: "A68484"

  11. Joel_Eisenstat

    2 Jan 2019 User since 2016

    Ok can do that but C36 is supposed to represent a button object,
    C36.backgroundColor = todaycolour; will work
    var c = "C" + dd; // dd = 36
    c.backgroundColor = todaycolour; doesn't work
    Creo doesn't see 'c' as button object even though it is C36 , a previous declared object ?

  12. marco

    2 Jan 2019 Administrator User since 2016

    C36 is a String, it cannot be a Button Object.

  13. Joel_Eisenstat

    2 Jan 2019 User since 2016

    Ok in Creo if the name of an object is is calculated, as in C36, can it be used for changing property values of the named object - .text , hidden, etc ?

  14. marco

    3 Jan 2019 Administrator User since 2016

    What you really need is a way to obtain a Creo object starting from its name.
    Let me think a bit more about this request.

  15. Joel_Eisenstat

    3 Jan 2019 User since 2016

    Exactly . That would be great help, especially as I move to classes and a proper framework.

or Sign Up to reply!