1. 7 years ago

    Joel_Eisenstat

    30 Oct 2016 User since 2016

    Hi ,
    I have started testing my "rough in" to get a feel for gravity and its dot notation. However I keep provoking the log error panel.
    For example a simple switch with a segmented control for the changed event :
    if (index = 0)
    { Window.Master.MasterTable.DataSet = PostGreSQL1.Query1;
    } else
    {Window.Master.MasterTable.DataSet = PostGreSQL1.Query2;
    }
    func {Window.Master.MasterTable.DataSet.run();
    }
    This gives multiple syntax errors .
    Are there plans in the near future to provide doc/examples for gravity ?
    Regards
    Joel

  2. marco

    30 Oct 2016 Administrator User since 2016
    Edited 7 years ago by marco

    Hi @Joel_Eisenstat yes sure we'll soon post a more comprehensive documentation about Gravity.
    Examining your code I don't understand what Window.Master is.
    Window is the a class name so it cannot be used as an identifier without generating a semantic error.

    I don't know what you would like to achieve so I am just guessing:
    I think you could have a Table inside a Window so probably your code should looks like:

    if (index == 0)  {
    Window1.MasterTable.DataSet = PostGreSQL1.Query1;
    } else {
    Window1.MasterTable.DataSet = PostGreSQL1.Query2;
    }
    Window1.MasterTable.DataSet.run();

    If you give me more details I am more than happy to assist you.

  3. Joel_Eisenstat

    31 Oct 2016 User since 2016

    Thanks Marco ,
    I am used to dot notation from an other scripting language that starts with root but I can see what is required to run.
    Joel

  4. Joel_Eisenstat

    31 Oct 2016 User since 2016

    Where drugList is the renamed Master window ( PageSplit Navigation)
    SegmentedControl1
    - Event Changed
    if (index = 0) {
    drugList.MasterTable.DataSet = PostgreSQL1.Query1;
    } else {
    drugList.MasterTable.DataSet = PostgreSQL1.Query2;
    }
    drugList.MasterTable.DataSet.run();

    still generates an error - "Syntax Error identifier expected here ( but found { }"

  5. marco

    31 Oct 2016 Administrator User since 2016

    Should be:

    if (index == 0) {...}
  6. Joel_Eisenstat

    31 Oct 2016 User since 2016

    Thanks - silly mistake , .
    Is there a refresh function as there are no visible changes in the list ?

  7. Joel_Eisenstat

    31 Oct 2016 User since 2016

    Tried reloadData() with same results - no refresh

  8. marco

    31 Oct 2016 Administrator User since 2016

    @Joel_Eisenstat you can skip the run method on DataSet (so just change it on the TableView)
    Then use the TableView.reloadData(); method as documented in:
    http://docs.creolabs.com/classes/TableView.html

  9. Joel_Eisenstat

    31 Oct 2016 User since 2016

    The project runs but now generates an error on using the segment control - syntax error
    if (index == 0) {
    drugList.MasterTable.DataSet = PostgreSQL1.Query1;//order by code
    } else {
    drugList.MasterTable.DataSet = PostgreSQL1.Query2; // order by id
    }
    drugList.MasterTable.reloadData();

  10. Joel_Eisenstat

    31 Oct 2016 User since 2016

    Also I notice the detail objects not matching after the attempted sort .

  11. Joel_Eisenstat

    31 Oct 2016 User since 2016

    now a runtime error - unable to find dataset

  12. marco

    31 Oct 2016 Administrator User since 2016
    Edited 7 years ago by marco

    Hi @Joel_Eisenstat some minor issues (dataSet case and a minor code improvement).
    In SegmentedControl1.Changed event write:

    if (index == 0) {
    	MasterTable.dataSet = PostgreSQL1.Query1;
    } else {
    	MasterTable.dataSet = PostgreSQL1.Query2;
    }
    MasterTable.reloadData();

    You do not need to specify drugList since you are executing the cose in the same window (and you have a direct access to all its controls).

  13. Joel_Eisenstat

    31 Oct 2016 User since 2016

    thanks again - works !. - need to get use to Gravity nomenclature and double-check
    Now onto Postgres class
    Joel

  14. Joel_Eisenstat

    1 Nov 2016 User since 2016

    Good Afternoon,
    In continuing with gravity can you explain how to reference an object's value from within an other.
    For example when the segment control is used to change the order the <Detail View dataSet > needs to be aligned. From the Master ( PageSplit Nav) SegmentedControl
    if (index == 0) {
    MasterTable.dataSet = PostgreSQL1.Query1; //set view for code order
    Detail.View1.dataSet = PostgreSQL1.Query1; --> This is the area I am having trouble with the notation
    } else {
    MasterTable.dataSet = PostgreSQL1.Query2; // set view for id order
    Detail.View1.dataSet = PostgreSQL1.Query2; --->
    }
    MasterTable.reloadData();

    or how can I see Master.SegmentedControl1.Index from the load event of View1 in the Detail window to changer the dataSet.
    Regards,
    Joel

  15. marco

    5 Nov 2016 Administrator User since 2016

    @Joel_Eisenstat I'll let you know soon.

or Sign Up to reply!