Syntax

  1. 6 years ago

    Joel_Eisenstat

    30 May 2017 User since 2016

    Good morning,
    Still getting use to the syntax. I am using a segmented control to sort a table ( id /lastname) which works fine but am having
    trouble passing the dataSet to the Detail window.
    if (index == 0) {
    MasterTable.dataSet = PostgreSQL1.Query;
    Detail.View1.dataSet = PostgreSQL1.Query;
    } else {
    MasterTable.dataSet = PostgreSQL1.Query1
    Detail.View1.dataSet = PostgreSQL1.Query1
    }
    Runtime Error
    Unable to find dataSet into class _View1

    Any direction is appreciated.
    Regards
    Joel

  2. marco

    30 May 2017 Administrator User since 2016

    Hi @Joel_Eisenstat,
    I sent you an unofficial version that should fix the issue via email

  3. Joel_Eisenstat

    30 May 2017 User since 2016

    Thanks again, that worked but I still have difficulty getting a handle on syntax .
    In a split view the master table is sorted ( id or last name) and is matched to the query.
    In addition I want to determine the "detail" window to open based on the segmented control index value
    This code gives me a log of syntax errors - surprised it doesn't run out of memory.
    //PageSplit1.openDetailWindowAtIndex(index);

    if (SegmentedControl1.windowindex) == 0 {
    PageSplit1.openDetailWindowAtIndex(index);
    } else if (SegmentedControl1.windowindex) == 1 {
    PageSplit1.Window1lWindowAtIndex(index);
    }else{
    PageSplit1.Window2lWindowAtIndex(index);
    }

    where windowindex is a property in the segmented control
    if (index == 0) {
    windowindex = 0 ;
    } else if (index == 1) {
    windowindex = 1 ;
    } else {
    windowindex = 2 ;
    }
    no errors here

    I imagine these are learning stage dumb errors but just as frustrating.
    Regards
    Joel

  4. marco

    31 May 2017 Administrator User since 2016

    @Joel_Eisenstat I am not sure to completely understand what are you trying to achieve but the SegmentControl has a Changed event that you can use (and an index parameter is passed to that event).
    http://docs.creolabs.com/classes/SegmentedControl.html

    So you could write the following code inside SegmentControl1.Changed event:

    PageSplit1.Window1lWindowAtIndex(index);

    Please let me know if you need further assistance.

  5. Joel_Eisenstat

    31 May 2017 User since 2016

    Good morning,
    I am using the SegmentControl to provide the direction for the Detail window. The master window consists of a SegmentControl(1) for the sorting of the MasterList . A second SegmentControl(2) determines which "Detail" opens - in this case one of three. I want to pass the index of the SegmentControl(2) to the MasterList to determine which window to open .

    Another syntax issue is using the SegmentControl to determine the template of the View.

    Also is a Switch (case) being planned for control ?

    Perhaps an example tutorial if there is time
    Regards
    Joel

  6. Joel_Eisenstat

    31 May 2017 User since 2016

    As another approach I tried to use the value of SegmentControl directly but received an error of
    Semantic Error - Assignment not allowed here

    if (Master.SegmentedControl1.index=1) {
    PageSplit1.openDetailWindowAtIndex(index);
    } else {
    PageSplit1.openWindow1WindowAtIndex(index);
    }
    Regards
    Joel

  7. marco

    31 May 2017 Administrator User since 2016

    The error is in the first line, you wrote:

    if (Master.SegmentedControl1.index = 1)

    instead of

    if (Master.SegmentedControl1.index == 1)
  8. Joel_Eisenstat

    31 May 2017 User since 2016

    Thanks same mistake as previously pointed out .
    Sorry about that ...

  9. Joel_Eisenstat

    31 May 2017 User since 2016

    However now generates 2 errors
    Syntax Error
    Expected } but found =.
    Syntax Error
    Expected expression but found }.
    Confused about rules of the road

  10. marco

    31 May 2017 Administrator User since 2016

    Can you please copy and paste the whole code here?

  11. Joel_Eisenstat

    31 May 2017 User since 2016

    Got it - extra character at bottom of editor

  12. Joel_Eisenstat

    31 May 2017 User since 2016

    Still has error of Runtime Error
    Unable to find index into class _SegmentedControl1

  13. Joel_Eisenstat

    31 May 2017 User since 2016

    if (Master.SegmentedControl1.index==1) {
    PageSplit1.openDetailWindowAtIndex(index);
    } else {
    PageSplit1.openWindow1WindowAtIndex(index);
    }

  14. marco

    1 Jun 2017 Administrator User since 2016

    According to SegmentedControl class documentation what you are looking for is called selectedSegmentIndex.

    Your code should look like:

    if (Master.SegmentedControl1.selectedSegmentIndex  == 1) {
    PageSplit1.openDetailWindowAtIndex(index);
    } else {
    PageSplit1.openWindow1WindowAtIndex(index);
    }

    You should always refer to the official documentation for class properties and methods.

    P.S. I agree that index would be a better name than selectedSegmentIndex so we'll probably rename it in the next beta version.

  15. marco

    1 Jun 2017 Administrator User since 2016

    @Joel_Eisenstat I confirm you that starting from the next version the property selectedSegmentIndex will be renamed to index.

  16. Joel_Eisenstat

    1 Jun 2017 User since 2016

    Thanks for the quick response

  17. Joel_Eisenstat

    4 Jun 2017 User since 2016

    "So you could write the following code inside SegmentControl1.Changed event:
    PageSplit1.Window1lWindowAtIndex(index); "

    Runtime Error
    Unable to find openWindow1WindowAtIndex into class _PageSplit1

    It seems that PageSplit only allows a single Detail window - in experimenting I can access windows 'outside ' the PageSplit hierarchy but not within. Not a big deal but led to other issues which are again syntax errors or not understanding the docs

    e.g. I can use Segmented Control to move windows but cannot get the appropriate segment highlighted.
    Tried - Window Load () - SegmentedControl1.setSegmentEnabled(true,0) to highlife the first segment, this seemed to be the correct method(?) but no response.

    Also since I cannot use the built in WindowAtIndex for multiple windows I tried using the example in
    Lets Cook Nav but the sql syntax fails to null
    var sql = "SELECT * FROM public.CRM_Pat WHERE id = 1";

    Its a little early in the game for community input but any comments are appreciated.

    Regards
    Joel

or Sign Up to reply!