Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Add entry as foreign key entry

    I have two datasources:

    TABLE1
    Code:
    		
    <fields>
    	<field primaryKey="true" name="id" type="sequence"></field>
    	<field name="amount" type="integer"></field>
    	<field name="createDatetime" type="datetime"></field>
    	<field name="userID" type="integer"></field>
    </fields>


    TABLE2
    Code:
    <fields>
    	<field primaryKey="true" name="id" type="sequence"></field>
    	<field nativeFK="TABLE1.id" name="entryID" type="integer"></field>
    	<field name="amount" type="integer"></field>
    	<field name="createDatetime" type="datetime"></field>
    	<field name="userID" type="integer"></field>
    </fields>
    I set a listgrid's datasource as TABLE2 with the criteria filtering on the TABLE1.id which shows what I want BUT the issue is when I want to add an entry no entry ID is supplied (I am assuming as no relationship is being found - how can I make this work?).

    Secondly I am trying to perform the following:

    Code:
    <field name="userID" type="integer" value="$session.userId">
    This does not work and return null yet when I use this on the server side it works?

    Code:
    HttpServletRequest request
    request.getSession().getAttribute("userId")
    Please could someone help I have been stuck with this issue for a number of days.

    Thank you.

    #2
    when I want to add an entry no entry ID is supplied (I am assuming as no relationship is being found - how can I make this work?).
    http://www.smartclient.com/smartgwte...ions_queued_md

    This does not work and return null yet when I use this on the server side it works?
    Refer to the Quick Start/Chapter 8/Velocity Expressions/Server-Assigned Criteria/Values.

    I have been stuck with this issue for a number of days
    ...

    Comment


      #3
      Thank you for your help, I really appreciate it.

      I managed to get the server side sessions to work now (thank you).

      The issue I am still faced with is passing a value to the insert. You provided an explanation to this and this shows two inserts which I tried to manipulate to an 'fetch' and then an 'add' within one RPCManager call. I perform the following with no success as id is not picked up.



      Code:
      <values fieldName="ProjectID" value="$responseData.last('Project_PS','fetch').id" />
      In code I perform the RPCManager start, call an update on Project_PS and then an insert on the datasource with the above line in.

      The reason I need this is I already have the parent loaded and I am creating additional children (while not updating/creating the parent). I need to feed in the parentId with the children.
      Last edited by Cal; 11 Jan 2013, 09:25.

      Comment


        #4
        So... just set the attribute value before you submit the save.

        Comment


          #5
          Is what you're saying that if this is part of a list grid I could then get all edits, iterate them and add the properties?

          Thanks - I'll try that now.

          Comment

          Working...
          X