Handling Relational Data in a Form?

View: New views
3 Messages — Rating Filter:   Alert me  

Handling Relational Data in a Form?

by jc_bad28 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've created a web service that returns a dataset from some relational tables.  Tables 1 and 2 are the source tables. View 1 is the selected data that I send out as XML from a web service for the Flex UI. View 1 lists out all of the operations and then a bunch of query stuff, I populate the operation with an 'x' if that operation is needed for the job or populate with a date if that operation is completed. When an operation isn't needed it returns NULL as not every job needs every operation.

table 1: Jobs
jobnum     clientname   qnty
-------------------------------------
jobA       Client A       10000
jobB       Client B        5000

table 2: Operations
ID         jobnum    Operation         Completed
------------------------------------------------
1          jobA        Laser             10-01-09
2          jobA        Insert            10-02-09
3          jobA        Ink jet           10-01-09
4          jobB        4 Color Press     10-02-09
5          jobB        Laser             10-02-09
6          jobB        Insert            x

View 1: AllJobs
jobnum  clientname   qnty  Laser     InkJet 4ColorPress  Insert
--------------------------------------------------------------------
jobA    Client A    10000  10-01-09  10-01-09  Null      10-02-09
jobB    Client B     5000  10-02-09  NULL     10-02-09      x  

I have my Flex UI setup to receive the View output as XML and then populate an Advanced Data Grid.  I've got a form section below that populates with the job data when a row is selected. The form section is for viewing or updating operation dates. (The form also shows some info returned in the xml that I don't show in the grid since I ran out of screen space in the grid.)

For updates, I was going to setup a loop to cycle through the webservice update operation.  However, where I'm stumped is passing the query info needed.  The SQL statement is straight forward where the parameters needed are jobnum and something to identify the operation.  And this is where I'm stumped.  I need to get the operationID from the operation table and I'm thinking it's not a good idea to query that into the view.  That it would be better to have a seperate query for the operations that I could then call via another webservice or webservice operation call.  But how would I get that related that into the form? Or I guess I could get the operationID in the grid, but hide those columns.  

The other idea was change the View to only show the operationID's and then have another webservice to relate the operationID to the operation dates.  But that mean needing to have my datagrid have 2 seperate datasources or someway to merge the data from two seperate services.

Any insight is greatly appreciated.






Re: Handling Relational Data in a Form?

by jc_bad28 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

AS3 really goes bonkers with array handling.  If I'm not mistaken, it looks like how you access array data is completely dependent on how the array is populated?  I finally got an array to populate from my form and then retrieved the array data in a trace().  It also looks like I can create multiple parallel arrays which might solve a lot of problems.

Array population code:

var array:Array= new Array();
                                            array.push({operationCompleted:Press10Env.text, jobnum:jobnum.text, resource:"10 Envelope Press"});
                                                array.push({operationCompleted:Press2clr.text, jobnum:jobnum.text, resource:"2 Color Press"});
                                                array.push({operationCompleted:Press4clrEnv.text, jobnum:jobnum.text, resource:"4 Color Envelope Press"});
                                                array.push({operationCompleted:Press4clr.text, jobnum:jobnum.text, resource:"4 Color Press"});
                                                array.push({operationCompleted:Press9Env.text, jobnum:jobnum.text, resource:"9 Envelope Press"});
                                                array.push({operationCompleted:FlowMasterMM.text, jobnum:jobnum.text, resource:"Flow Master MM"});
                                                array.push({operationCompleted:InkJet.text, jobnum:jobnum.text, resource:"InkJet"});
                                                array.push({operationCompleted:Inserting.text, jobnum:jobnum.text, resource:"Inserting"});
                                                array.push({operationCompleted:LaserLetter.text, jobnum:jobnum.text, resource:"Laser Letter"});
                                                array.push({operationCompleted:LaserRoom.text, jobnum:jobnum.text, resource:"Laser Room"});
                                               
                                        //var operationsCollection:ArrayCollection = new ArrayCollection(shopOperations);
                                        var index:int;
                                       
                                   for( index = 0; index < array.length; index++ )
                                   {
                                     
                                      trace(array[index].jobnum+ " "+array[index].resource+ " "+array[index].operationCompleted);
                                   }

--- In flexcoders@..., "jc_bad28" <jc_bad28@...> wrote:

>
> I've created a web service that returns a dataset from some relational tables.  Tables 1 and 2 are the source tables. View 1 is the selected data that I send out as XML from a web service for the Flex UI. View 1 lists out all of the operations and then a bunch of query stuff, I populate the operation with an 'x' if that operation is needed for the job or populate with a date if that operation is completed. When an operation isn't needed it returns NULL as not every job needs every operation.
>
> table 1: Jobs
> jobnum     clientname   qnty
> -------------------------------------
> jobA       Client A       10000
> jobB       Client B        5000
>
> table 2: Operations
> ID         jobnum    Operation         Completed
> ------------------------------------------------
> 1          jobA        Laser             10-01-09
> 2          jobA        Insert            10-02-09
> 3          jobA        Ink jet           10-01-09
> 4          jobB        4 Color Press     10-02-09
> 5          jobB        Laser             10-02-09
> 6          jobB        Insert            x
>
> View 1: AllJobs
> jobnum  clientname   qnty  Laser     InkJet 4ColorPress  Insert
> --------------------------------------------------------------------
> jobA    Client A    10000  10-01-09  10-01-09  Null      10-02-09
> jobB    Client B     5000  10-02-09  NULL     10-02-09      x  
>
> I have my Flex UI setup to receive the View output as XML and then populate an Advanced Data Grid.  I've got a form section below that populates with the job data when a row is selected. The form section is for viewing or updating operation dates. (The form also shows some info returned in the xml that I don't show in the grid since I ran out of screen space in the grid.)
>
> For updates, I was going to setup a loop to cycle through the webservice update operation.  However, where I'm stumped is passing the query info needed.  The SQL statement is straight forward where the parameters needed are jobnum and something to identify the operation.  And this is where I'm stumped.  I need to get the operationID from the operation table and I'm thinking it's not a good idea to query that into the view.  That it would be better to have a seperate query for the operations that I could then call via another webservice or webservice operation call.  But how would I get that related that into the form? Or I guess I could get the operationID in the grid, but hide those columns.  
>
> The other idea was change the View to only show the operationID's and then have another webservice to relate the operationID to the operation dates.  But that mean needing to have my datagrid have 2 seperate datasources or someway to merge the data from two seperate services.
>
> Any insight is greatly appreciated.
>



Re: Handling Relational Data in a Form?

by Paul Andrews-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

jc_bad28 wrote:

> I've created a web service that returns a dataset from some relational tables.  Tables 1 and 2 are the source tables. View 1 is the selected data that I send out as XML from a web service for the Flex UI. View 1 lists out all of the operations and then a bunch of query stuff, I populate the operation with an 'x' if that operation is needed for the job or populate with a date if that operation is completed. When an operation isn't needed it returns NULL as not every job needs every operation.
>
> table 1: Jobs
> jobnum     clientname   qnty
> -------------------------------------
> jobA       Client A       10000
> jobB       Client B        5000
>
> table 2: Operations
> ID         jobnum    Operation         Completed
> ------------------------------------------------
> 1          jobA        Laser             10-01-09
> 2          jobA        Insert            10-02-09
> 3          jobA        Ink jet           10-01-09
> 4          jobB        4 Color Press     10-02-09
> 5          jobB        Laser             10-02-09
> 6          jobB        Insert            x
>
> View 1: AllJobs
> jobnum  clientname   qnty  Laser     InkJet 4ColorPress  Insert
> --------------------------------------------------------------------
> jobA    Client A    10000  10-01-09  10-01-09  Null      10-02-09
> jobB    Client B     5000  10-02-09  NULL     10-02-09      x  
>
> I have my Flex UI setup to receive the View output as XML and then populate an Advanced Data Grid.  I've got a form section below that populates with the job data when a row is selected. The form section is for viewing or updating operation dates. (The form also shows some info returned in the xml that I don't show in the grid since I ran out of screen space in the grid.)
>
> For updates, I was going to setup a loop to cycle through the webservice update operation.  However, where I'm stumped is passing the query info needed.  The SQL statement is straight forward where the parameters needed are jobnum and something to identify the operation.  And this is where I'm stumped.  I need to get the operationID from the operation table and I'm thinking it's not a good idea to query that into the view.
Why not? I don't see what the problem would be.
> That it would be better to have a seperate query for the operations that I could then call via another webservice or webservice operation call.  But how would I get that related that into the form? Or I guess I could get the operationID in the grid, but hide those columns.
>  
Your datagrid can have a source containing the operations id - it's not
compulsory for a datagrid to display all the data from the data source.
> The other idea was change the View to only show the operationID's and then have another webservice to relate the operationID to the operation dates.  But that mean needing to have my datagrid have 2 seperate datasources or someway to merge the data from two seperate services.
>  
Don't do it - it's totally unnecessary.
> Any insight is greatly appreciated.
>  
No particular insight - just an opinion - I really don't see the
difficultly.

Paul