[flexcoders] Using TOTAL and AS in the SQL of a Flex app

2008-08-11 Thread bredwards358

I really don't know where to post this, as it involves both SQLite
and Flex 3, but, I'll try here first. Here's what I have in
FlexBuilder:



sqlText = SELECT Up18RODetail.ProductID, TOTAL(Up18RODetail.Qty) AS
:qtySum  +

 FROM Up18RODetail LEFT JOIN
Up18ROHeader ON Up18RODetail.ROID = Up18ROHeader.ROID  +

 WHERE Up18ROHeader.DateUploaded
Between :startDate AND :endDate  +

 GROUP BY Up18RODetail.ProductID  +

 HAVING Up18RODetail.ProductID =
:prodProdID;



 transactionStatement = new SQLStatement();

 conn = new SQLConnection();

 transactionStatement.sqlConnection = conn;

 conn.open(dbFile);


transactionStatement.addEventListener(SQLEvent.RESULT,
calcUsePercentResult);


transactionStatement.addEventListener(SQLErrorEvent.ERROR,
errorHandler);

 transactionStatement.text = sqlText;

 transactionStatement.parameters[:startDate] =
startDate;

 transactionStatement.parameters[:endDate] =
endDate;

 transactionStatement.parameters[:qtySum] =
qtySum; //String variable

 transactionStatement.parameters[:prodProdID] =
prodDataArray[i].ProductID

 transactionStatement.execute();

Now, the SQL actually works in the SQLite database browser, however it
throws a SQL syntax error when I try to run it in my flex app and
I'm not sure why. The error reads SQLError: 'Error #3115: SQL
Error.', details:'near :qtySum: syntax error', operation:'execute'. I
could sure use a hand here, thanks in advanceĀ…

Brian Ross Edwards

Tech-Connect LLC



[flexcoders] Re: Using TOTAL and AS in the SQL of a Flex app

2008-08-11 Thread bredwards358
Of course, it was revealed to me a short while ago that you can't
parameterize a column alias that was the whole problem. Thanks.

--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Monday 11 Aug 2008, bredwards358 wrote:
  sqlText = SELECT Up18RODetail.ProductID, TOTAL(Up18RODetail.Qty) AS
  :qtySum  +
  I'm not sure why. The error reads SQLError: 'Error #3115: SQL
  Error.', details:'near :qtySum: syntax error',
operation:'execute'. I
 
 You can't use a bind variable there as it's not the 'value' of an
expression.
 You maybe want
 sqlText = SELECT Up18RODetail.ProductID, TOTAL(Up18RODetail.Qty) AS + 
 qtySum  +
 instead, but beware of the SQL injection problems.
 
 -- 
 Tom Chiverton
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at Halliwells LLP, 3 Hardman Square, Spinningfields,
Manchester, M3 3EB.  A list of members is available for inspection at
the registered office. Any reference to a partner in relation to
Halliwells LLP means a member of Halliwells LLP.  Regulated by The
Solicitors Regulation Authority.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above
and may be confidential or legally privileged.  If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents.  If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 2500.
 
 For more information about Halliwells LLP visit www.halliwells.com.





[flexcoders] SummaryObject Warning, no clue what it means...

2008-08-07 Thread bredwards358
While checking to make sure my summary information was correct, I got
this warning while debugging the application:

warning: unable to bind to property 'total2' on class
'mx.collections::SummaryObject' (class is not an IEventDispatcher)
warning: unable to bind to property 'total3' on class
'mx.collections::SummaryObject' (class is not an IEventDispatcher)

While the information displays correctly, I can't seem to figure out
what this warning means, much less how to correct it. I need some
clarification on this. Thanks in advance,

Brian Ross Edwards
Tech-Connect LLC




[flexcoders] More than one summary field in a summary row?

2008-08-04 Thread bredwards358
While building report generation for our application, I noticed that
while trying to properly display summary information, I can only seem
to get one of the desired summary fields to display, here's the code
I'm using:

//Sets the grouping and summary stuff
rptGrpSr = new SummaryRow();

var qtySum:SummaryField = new SummaryField();
qtySum.dataField = Qty;
qtySum.operation = SUM;
qtySum.label = summary;

var costSum:SummaryField = new SummaryField();
costSum.dataField = ListCost;
costSum.operation = SUM;
costSum.label = summary;

var extSum:SummaryField = new SummaryField();
extSum.dataField = Ext;
extSum.operation = SUM;
extSum.label = summary;

rptGrpSr.fields = [qtySum, costSum, extSum];
rptGrpSr.summaryPlacement = last;
rptGrpCol = new GroupingCollection();
rptGrpCol.source = model.repairOrderData;
rptGrping = new Grouping();
rptGF = new GroupingField(TechID);
rptGF.summaries = [rptGrpSr];
rptGrping.fields=[rptGF];
rptGrpCol.grouping = rptGrping;

Now it may just have something to do with the how I'm assigning the
summary fields to the row. However if what I want to do is not
possible with how I have things set up then how could I get this to
work? Thanks in advance as always.

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Re: More than one summary field in a summary row?

2008-08-04 Thread bredwards358
Problem solved, I simply used multiple render providers in the summary
row to display the data. Though if a better way exists I wouldn't mind
hearing it.

--- In flexcoders@yahoogroups.com, bredwards358 [EMAIL PROTECTED]
wrote:

 While building report generation for our application, I noticed that
 while trying to properly display summary information, I can only seem
 to get one of the desired summary fields to display, here's the code
 I'm using:
 
 //Sets the grouping and summary stuff
 rptGrpSr = new SummaryRow();
   
 var qtySum:SummaryField = new SummaryField();
 qtySum.dataField = Qty;
 qtySum.operation = SUM;
 qtySum.label = summary;
   
 var costSum:SummaryField = new SummaryField();
 costSum.dataField = ListCost;
 costSum.operation = SUM;
 costSum.label = summary;
   
 var extSum:SummaryField = new SummaryField();
 extSum.dataField = Ext;
 extSum.operation = SUM;
 extSum.label = summary;
   
 rptGrpSr.fields = [qtySum, costSum, extSum];
 rptGrpSr.summaryPlacement = last;
 rptGrpCol = new GroupingCollection();
 rptGrpCol.source = model.repairOrderData;
 rptGrping = new Grouping();
 rptGF = new GroupingField(TechID);
 rptGF.summaries = [rptGrpSr];
 rptGrping.fields=[rptGF];
 rptGrpCol.grouping = rptGrping;
 
 Now it may just have something to do with the how I'm assigning the
 summary fields to the row. However if what I want to do is not
 possible with how I have things set up then how could I get this to
 work? Thanks in advance as always.
 
 Brian Ross Edwards
 Tech-Connect LLC





[flexcoders] Re: How to best implement this barcode generator...

2008-07-29 Thread bredwards358
I didn't realize Barcodes could be used as a font, thanks. However for
our purposes we need type 128 barcodes which I'm not sure I can find
for free, but I'll keep looking and messing around with the component
I got yesterday.

--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Monday 28 Jul 2008, bredwards358 wrote:
  Right now I'm trying to figure out how to implement Barcode generation
  in my AIR app since two of the reports I need this to be able to print
  require a list of Barcodes
 
 You could just use a suitable barcode font. There's a free 6of9 (or
whatever 
 the standard is) one.
 
 -- 
 Tom Chiverton
 
 
 
 This email is sent for and on behalf of Halliwells LLP.
 
 Halliwells LLP is a limited liability partnership registered in
England and Wales under registered number OC307980 whose registered
office address is at Halliwells LLP, 3 Hardman Square, Spinningfields,
Manchester, M3 3EB.  A list of members is available for inspection at
the registered office. Any reference to a partner in relation to
Halliwells LLP means a member of Halliwells LLP.  Regulated by The
Solicitors Regulation Authority.
 
 CONFIDENTIALITY
 
 This email is intended only for the use of the addressee named above
and may be confidential or legally privileged.  If you are not the
addressee you must not read it and must not use any information
contained in nor copy it nor inform any person other than Halliwells
LLP or the addressee of its existence or contents.  If you have
received this email in error please delete it and notify Halliwells
LLP IT Department on 0870 365 2500.
 
 For more information about Halliwells LLP visit www.halliwells.com.





[flexcoders] Setting the dataGrid column's font and leaving the header alone?

2008-07-29 Thread bredwards358
So, today I found a type128 barcode font which fits the purposes of
the application we're developing quite nicely. However I've hit a bit
of a snag. When the font family of a dataGrid column is set, it sets
both the font of the column's items as well as the column header. This
would be fine if the font displayed normal letters other than the
usual Verdana, but when its barcodes...

Essentially I want to know if it is possible to set the font of the
column's items separately from the header itself. Is this possible?



[flexcoders] Re: Setting the dataGrid column's font and leaving the header alone?

2008-07-29 Thread bredwards358
Thank you, that worked perfectly.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 I think you have to make a custom header renderer that forces its font
 family back to something you want.
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of bredwards358
 Sent: Tuesday, July 29, 2008 11:07 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Setting the dataGrid column's font and leaving the
 header alone?
 
  
 
 So, today I found a type128 barcode font which fits the purposes of
 the application we're developing quite nicely. However I've hit a bit
 of a snag. When the font family of a dataGrid column is set, it sets
 both the font of the column's items as well as the column header. This
 would be fine if the font displayed normal letters other than the
 usual Verdana, but when its barcodes...
 
 Essentially I want to know if it is possible to set the font of the
 column's items separately from the header itself. Is this possible?





[flexcoders] How to best implement this barcode generator...

2008-07-28 Thread bredwards358
Recently I got this barcode generation component from this place:

http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetailloc=en_usextid=1179012

Right now I'm trying to figure out how to implement Barcode generation
in my AIR app since two of the reports I need this to be able to print
require a list of Barcodes to be printed alongside the data it is
supposed to represent. Such as when a customer prints out a list of
items and needs to be able to simply scan the barcode to use that item
data. Sounds a bit vague I know but it's the best way I can describe
it at the moment.

Right now in my report printing I use a PrintAdvancedDataGrid and so I
wonder, could I use this barcode component as an itemrenderer or
something along those lines? If not in the dataGrid, then perhaps
inside a repeater right next to the dataGrid? The dataGrid itself is
generated dynamically via AS3. I've only just begun messing with the
component so I don't know quite how it works yet.

Thanks in advance

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Numeric values drawn from a database, always int?

2008-07-21 Thread bredwards358
So far so good in the application currently in development, I feel
like I'm in the home stretch. However something has come up which
could prove to be a roadblock in the near future. There are some
values which need to be totaled up and some of those need decimals.
Now I realize that the int datatype doesn't deal with that, and the
only thing I've seen thus far which fills the same purpose as a double
datatype is the Number datatype. However when I try something like this:

for(var i:int; i  n; i++)
{
total2 += dgProvider[i].ProductList;
total3 += dgProvider[i].Cost;
}

If total2 and total3 are of the Number datatype, the result will
display as NaN or Not a Number. This works fine however if total2
and total3 are declared as int. What I'm wondering is, are numeric
values drawn from a database (SQL Lite here) automatically cast as
int? Even if the database has them as NUMERIC and not INTEGER? If so,
then would I be able to work around this by doing something like this?

for(var i:int; i  n; i++)
{
total2 += Number(dgProvider[i].ProductList);
total3 += Number(dgProvider[i].Cost);
}

I'm just asking for some clarification on this before I finally get
around to it after finishing up a few things on this project. Thanks
in advance,

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Re: Numeric values drawn from a database, always int?

2008-07-21 Thread bredwards358
Bingo, thanks that I believe was exactly what I needed, it would seem
that when I'm making the database tables, it would be best to use REAL
and/or NUMBER as opposed to NUMERIC and/or INTEGER to best utilize
numbers with decimal points.

Brian Ross Edwards
Tech-Connect LLC

--- In flexcoders@yahoogroups.com, Jim Hayes [EMAIL PROTECTED] wrote:

 I think you can find the answers here :
  
 http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/?localDatabase
 SQLSupport.html#dataTypes
  
 (I'd been meaning to look this up in any case, you just prompted me! Not
 finished reading it all as yet.)
  
  
  
  




[flexcoders] Finding a date between dates

2008-07-15 Thread bredwards358
Sounds like a simple question and easily answered by a search, but
considering my own search-fu and not really finding anything
specifically relating to my question after my search I decided just to
post this.

In the app I'm working on, the user can print out reports by selecting
two dates and getting info on orders placed between those two dates.
How it works thus far is that the user picks the two dates from two
date chooser controls, and clicks the button. How the report itself is
generated and displayed doesn't apply here, I just need to figure out
how to get the info I need from the database.

All my dates are saved in the database(SQL Lite as text) using
something like this:

transactionStatement.parameters[:dateUpdated] = new Date().toString();

This keeps it in the format the user is most familiar with. However
I'm not exactly sure how comparisons can be done to find a date
between too others since they're not exactly numbers. Basically this
all boils down to, what do I need to do to find all dates which fall
between two selected dates?

Thanks in advance,
Brian Ross Edwards,
Tech-Connect LLC



[flexcoders] Re: Finding a date between dates

2008-07-15 Thread bredwards358
Alright, thanks I'll give that a shot. If something's amiss then I'll
come back with more questions

--- In flexcoders@yahoogroups.com, Sid Maskit [EMAIL PROTECTED] wrote:

 One of the ways that Adobe modified the SQLite database is to have
added a date datatype. If you use that, I would think that it would
also support standard SQL such as the between operator. Also,you
should be able to read from the database field directly back into a
date chooser control. Similarly, if you then upload data from the
local database to a remote database, it should correctly map onto a
date field in the remote database.
 
 
 
 - Original Message 
 From: bredwards358 [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Tuesday, July 15, 2008 8:35:36 AM
 Subject: [flexcoders] Finding a date between dates
 
 
 Sounds like a simple question and easily answered by a search, but
 considering my own search-fu and not really finding anything
 specifically relating to my question after my search I decided just to
 post this.
 
 In the app I'm working on, the user can print out reports by selecting
 two dates and getting info on orders placed between those two dates.
 How it works thus far is that the user picks the two dates from two
 date chooser controls, and clicks the button. How the report itself is
 generated and displayed doesn't apply here, I just need to figure out
 how to get the info I need from the database.
 
 All my dates are saved in the database(SQL Lite as text) using
 something like this:
 
 transactionStatemen t.parameters[ :dateUpdated ] = new
Date().toString( );
 
 This keeps it in the format the user is most familiar with. However
 I'm not exactly sure how comparisons can be done to find a date
 between too others since they're not exactly numbers. Basically this
 all boils down to, what do I need to do to find all dates which fall
 between two selected dates?
 
 Thanks in advance,
 Brian Ross Edwards,
 Tech-Connect LLC





[flexcoders] Re: Dynamically generated dataGrid not showing up in Print View component

2008-07-14 Thread bredwards358
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Try validateNow() at some point.  Printing runs before validation so
 sometimes you have to force validation
 
  
 
 

Ok, update time, I discovered that my dynamic dataGrid generation was
working perfectly as I found it inside my main application window with
all the required data and columns, however, the PrintAdvancedDataGrid
inside the PrintView Component still is not showing up. I have not
tried actually printing it yet since the last time I tried it queued
up 366 pages!

Anyhoo, here's the printPreview function I wrote to display the
component inside a window so I can see what it looks like without
wasting too much paper. I think the issue might be with how things are
assigned to each other. Things look a bit confusing at the moment but
at least I can build the dataGrids correctly.

Here's my code thus far:

private function openPOPrint():void
{
dgProvider = new ArrayCollection();
MatMgr.Globals.openIndex = 0;
dataManager.selectOpenPO();
dgProvider = model.purchaseOrderData;
reportHead = Open Purchase Orders;
dfArray =
[{label:'POID'},{label:'DateUpdated'},{label:'ProductList'},{label:'Cost'}]
headerArray = [{label:'PO
ID'},{label:'Date'},{label:'List'},{label:'Cost'}]
Alert.show(Preview?,Preview?,Alert.YES
|Alert.NO|Alert.CANCEL,null,clickHandler);
//doPrint();
}
private function clickHandler(event:CloseEvent):void
{
if(event.detail == Alert.YES)
{
buildDG(dfArray,headerArray);
printPreview();
}
else if(event.detail == Alert.NO)
{
buildDG(dfArray,headerArray);
doPrint();
}
}
//Keep in mind the buildDG function works perfectly in building
//the data grids. I'm just having trouble getting the print data grid
//to show up in the print preview component
public function printPreview():void
{
var thePrintView:FormPrintView = new FormPrintView();
preWindow = new Window();
preWindow.title = Print Preview;
preWindow.width = 800;
preWindow.height = 600;
preWindow.addChild(thePrintView);
thePrintView.width = preWindow.width;
thePrintView.height = preWindow.height;
adgTemplate.dataProvider = dgProvider;
thePrintView.myDataGrid.source = adgTemplate;
thePrintView.prodTotal = prodTotal;
thePrintView.reportHead = reportHead;
thePrintView.myDataGrid.dataProvider = dgProvider;
thePrintView.myDataGrid.validateNow();
thePrintView.showPage(single);
preWindow.open();
}

Thanks in advance,
Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Dynamically generated dataGrid not showing up in Print View component

2008-07-09 Thread bredwards358
I have a problem which is proving very difficult to place, I am
implementing logic to dynamically generate an advanced datagrid and
set it as the source to a printAdvancedDataGrid in a component which
is the print view of whatever report that needs to be printed. Problem
is, while it looks like the dataGrid, its columns and thier dataFields
are being generated properly, when I try to print out the report or
display the printView component in a simple little print Preview I
whipped up, the PrintAdvancedDataGrid is not showing up at all. I
really don't have much to go on so here's some code so you might be
able to see where I might be going wrong.

private function openPOPrint():void
{
dgProvider = new ArrayCollection();
DataManager.openIndex = 0;
dataManager.selectPOData();
dgProvider = model.purchaseOrderData;
reportHead = Open Purchase Orders;
dfArray =
[{label:'POID'},{label:'DateUpdated'},{label:'ListCost'},{label:'ProductCost'}]
headerArray = [{label:'PO
ID'},{label:'Date'},{label:'List'},{label:'Cost'}]
Alert.show(Preview?,Preview?,Alert.YES
|Alert.NO|Alert.CANCEL,null,clickHandler);
//doPrint();
}

private function buildDG(dfArray:Array,headerArray:Array):void
{
var aColumnDef:Array = getColumnDefArray(dfArray,headerArray);
var bColumnDef:Object;
adgTemplate = new AdvancedDataGrid();
var adgc:AdvancedDataGridColumn;
var columnsToAdd:Array = adgTemplate.columns;
for(var i:int = 0;i aColumnDef.length; i++)
{
bColumnDef = aColumnDef[i];
adgc = new 
AdvancedDataGridColumn(bColumnDef.headerText);
adgc.dataField = bColumnDef.dataField;
adgc.visible = bColumnDef.visible;
columnsToAdd.push(adgc);
}
adgTemplate.columns = columnsToAdd;
Application.application.addChild(adgTemplate);
}

private function
getColumnDefArray(dfArray:Array,headerArray:Array):Array
{
var aColumns:Array = new Array();
var df:Array = dfArray;
var headers:Array = headerArray;
var columnDef:Object;
for(var i:int = 0;i  df.length;i++)
{
columnDef = new Object;
columnDef.headerText = headers[i].label;
columnDef.dataField = df[i].label;
columnDef.visible = true;
aColumns.push(columnDef);

}
return aColumns;
}

//The last two functions are based off this:
http://www.cflex.net/showFileDetails.cfm?ObjectID=552Object=FileChannelID=1
//Here is my doPrint();

private function doPrint():void {

var printJob:FlexPrintJob = new FlexPrintJob();
if (printJob.start()) {

var thePrintView:FormPrintView = new FormPrintView();
Application.application.addChild(thePrintView);

thePrintView.width=printJob.pageWidth;
thePrintView.height=printJob.pageHeight;
thePrintView.myDataGrid.source = adgTemplate;
thePrintView.prodTotal = prodTotal;
thePrintView.reportHead = reportHead;
thePrintView.myDataGrid.dataProvider = dgProvider;
thePrintView.showPage(single);

if(!thePrintView.myDataGrid.validNextPage)
{
printJob.addObject(thePrintView);
}
else
{
thePrintView.showPage(first);
printJob.addObject(thePrintView);
thePrintView.pageNumber++;

while(true)
{
thePrintView.myDataGrid.nextPage();
thePrintView.showPage(last);

if(!thePrintView.myDataGrid.validNextPage) 
{
printJob.addObject(thePrintView);
break;
}
else
{
thePrintView.showPage(middle);
printJob.addObject(thePrintView);
thePrintView.pageNumber++;
}
}
}
Application.application.removeChild(thePrintView);
}
printJob.send();
}

Thanks in advance, Brian Ross Edwards



[flexcoders] Printing Templates: When you need more than one

2008-07-08 Thread bredwards358
So far in my odyssey to build the printing functionality for the AIR
app I'm building, I've run into a dilemma. I have a print view
component which holds the meat of what needs to be printed plus the
header and footer which is made visible and invisible depending on
what page is being printed. The header and footer are separate
components themselves.

My problem, is that I have about ten or twelve different report types
that I need to print and I'm stuck trying to figure out how to go
about this. Each report will use a PrintAdvancedDataGrid to display
its data. I thought initially about changing the print view component
dynamically, but that would involve being able to add columns, assign
them data fields, and name the headers dynamically at runtime, which
I'm not even sure I can do via actionscript though I could be missing
something. That's not even mentioning grouping.

Or, I could simply create a printView object for each report, and
simply call an instance of whatever I need in the doPrint(). This is
the simplest method and what I'll probably end up doing, but I'd like
some advice first. Thanks in advance,

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Print Preview, figuring out just how to do it.

2008-07-07 Thread bredwards358
Thankfully, the basic printing functionality of Flex was all I needed
to print out the very basic looking reports I need for my application.
However, another requirement is adding Print Preview functionality. So
far in my experimentation I've managed to display what should be on
the report by opening up at least the first page in a window as seen
in this code:

private function printPreview():void
{
 var thePrintView:FormPrintView = new FormPrintView();
 var preWindow:Window = new Window();
 preWindow.title = Print Preview;
 preWindow.width = 800;
 preWindow.height = 600;
 preWindow.addChild(thePrintView);
 thePrintView.width = preWindow.width;
 thePrintView.height = preWindow.height;
 thePrintView.prodTotal = prodTotal;
 thePrintView.myDataGrid.dataProvider = myDataGrid.dataProvider;
 preWindow.open();
}

Very basic but is really only good for showing the first page though I
believe I can allow for the displaying of multiple pages if I can
figure that out. Then comes the task of getting rid of the lines in
the print data grid and sizing the window properly.

Now, I am aware of the marvelous looking FlexReport at
http://www.kemelyon.com/bts/, however I am at a loss as how to
install it so to speak (Meaning I have no idea what files and
components I need to copy over in order to use it).

Any hints or points in the right direction are very much welcome.
Thanks in advance,

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Re: Print Preview, figuring out just how to do it.

2008-07-07 Thread bredwards358
Of course, Subversion, I haven't used that since my last Java class
back in school, I just need to figure out how to use it again. :P That
should help quite a bit once I get it downloaded and figure out what
component goes where. Thanks.

--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:

 On Monday 07 Jul 2008, bredwards358 wrote:
  Now, I am aware of the marvelous looking FlexReport at
  http://www.kemelyon.com/bts/, however I am at a loss as how to
  install it so to speak (Meaning I have no idea what files and
  components I need to copy over in order to use it).
 
 Ummm, from http://www.kemelyon.com/bts/2008/02/02/flexreport-update-2/
  please checkout the sources using svn in 
 googlecode[http://code.google.com/p/flexreport/]  ?
 
 -- 
 Tom Chiverton
 




[flexcoders] Help me sort out my reporting needs...

2008-06-30 Thread bredwards358
I am well aware of the limitations with printing reports in Flex,
however considering how far along we are in our project, there's no
turning back now and I'm currently researching the best way to
implement report printing in the application. Since this is an AIR
app, it all needs to be client side, right now I'm looking at
FlexReport (http://www.kemelyon.com/bts/), and AlivePDF
(http://www.alivepdf.org/) for our reporting needs. 

I could also be over complicating things, as the reports that need to
be printed are dead simple, consisting of only a header and the needed
data. But then again considering my own (brief, going on four months)
experience with coding in flex, the simplest things can be most
difficult things to work out. Basically what I'm looking for from here
is yet again a point in the right direction, to some tutorials or code
on printing very basic, multi-page reports in flex. 

I'm looking over the code behind FlexReport and very soon Alive PDF,
but  it's slow going considering I have to figure out how to integrate
all the needed files and components into my AIR app and get them
working properly. Once again, thanks in advance, this group has been
supremely helpful.

Brian Ross Edwards,
Tech-Connect LLC



[flexcoders] Re: Help me sort out my reporting needs...

2008-06-30 Thread bredwards358
Fair enough, as I said our reporting needs are very simple, just a
header and the required data, after downloading AlivePDF and looking at
it for a bit I can tell this is the front runner. FlexReport's lack of
an install guide and not having as much documentation marked it down in
my eyes but I can't fault it for that since the creator is incredibly
busy and can't work on it as much as he would.

Anyhoo, it would seem that my only problem with this would be to figure
out when to make a new page. Hopefully that shouldn't be too hard. How
I'm thinking this will go down is that when the user decides on a
report, the app will collate the data, generate the PDF and display it
in a window component containing an HTML component.

--- In flexcoders@yahoogroups.com, Richard Rodseth [EMAIL PROTECTED]
wrote:

 I've only looked at AlivePDF briefly, but like the Flex print job, you
 can point it at a component you want added to the PDF. So I would
 imagine you'd create a separate print layout view that you may or
 may not make visible to the user. And pagination is up to you.

 By the way, I believe that with AlivePDF and Flash Player 10, you'll
 be able to generate the PDF without the round trip to the server.


Well this is all client side, no trip to a server required.




[flexcoders] Re: Report Formatting

2008-06-27 Thread bredwards358
There is also FlexReport which also looks just as promising

http://www.kemelyon.com/bts/

--- In flexcoders@yahoogroups.com, Rick Winscot [EMAIL PROTECTED]
wrote:

 Oh! Oh! 
 
  
 
 http://www.alivepdf.org/ 
 
  
 
 Rick Winscot
 
  
 
  
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of Dan Pride
 Sent: Friday, June 27, 2008 3:33 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Report Formatting
 
  
 
 Hi
 I want to print out a report. The data goes beyond the scope of a
datagrid.
 I suppose I could use php but is there a way to do a long multi page
report
 in Flex?
 
 Dan





[flexcoders] Re: Small problem with database delete function

2008-06-25 Thread bredwards358
Okay, problem solved, mismatched with the wrong sql statement and
parameters.



[flexcoders] Small problem with database delete function

2008-06-24 Thread bredwards358
I am nearly done implementing database interactivity with the piece of
the application I'm working on.  One problem remains before the minor
stuff which will wait until after all crucial functionality is finished.
What's supposed to happen and what actually does happen except for the
issue is that for each order there is a header attached to it. The user
can open up a list of orders which is represented by the headers. From
there the user can click to edit an order which brings up the actual
order itself from the needed table. The issue is that when the user
wishes to delete an order, the order gets deleted, but the products
associated with said order remain, only one gets deleted. While
everything pretty much works, all those leftover items in the table
building up is not good.

Here's the code so far:

private function deletePORO():void
{
 try
 {
 selectedIndex = dgOrders.selectedItem.ROID;//Index of the item
being selected
 dataManager.deleteRO(selectedIndex);//Deletes the header row
 DataManager.openIndex = selectedIndex;//Index of the rows that
need to be deleted from the actual Order
 dataManager.getData(Repair Order);//Gets a copy of the info
from the database and assigns it to an arrayCollection
 //Loops through the Repair order data deleting all rows with the
same ROID as the ROHeader being deleted
 //Yet after all is said and done it only deletes one item and
nothing else
 //Everything else works fine but this
 var n:int = model.repairOrderData.length;
 for (var i:int = 0; i  n; i++)
 {
 if(model.repairOrderData[i].ROID == selectedIndex)
 {
 dataManager.deleteROItem(model.repairOrderData[i].ROID);
 }
 }
 model.roSearchData.removeItemAt(selectedIndex);
 }
 catch(ex:Error)
 {
 Alert.show(Error Found:  +
ex.toString(),Error,Alert.OK,this);
 }
}

Thanks in advance for any helpful hints or advice

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Passing Values between windows

2008-06-19 Thread bredwards358
In the application I'm currently developing, end users need to log in
to utilize it. Also I need to keep track of who is logged in so that I
can input that into a local database after certain actions. I've tried
using a public variable in a commonly used class, however since an
instance of that class is newly declared when a new window opens up
the value is set back to null, making it unusable. I've heard of using
an actionscript file inside a package used by the App containing the
variables but since the examples I've seen have them as static and
const variables and thus can't be changed from their default values.
So my question is this, is it possible in AIR to pass the value of a
variable from the native application window to another window component?

To help clear things up, essentially the user logs in and the username
is set as the value of a variable declared someplace, then in another
window, an action takes place, info is recorded in the database and
the app looks up the username in the variable, and records it along
with the other stuff in the db.



[flexcoders] Problem with getting most recently inserted ArrayCollection item

2008-06-18 Thread bredwards358
After fixing an issue regarding where best to put an insert function
call in my drag and drop function I now have another issue. It seems
that it is simply not seeing the most recently dropped item. For
instance, when I drop the very first item, it throws an error saying
that 0 (The index of the item being dropped) is out of bounds. This
error is thrown for every new item inserted afterward, when the second
item is inserted it will say that 1 is out of bounds. Interestingly
enough, updates to the ArrayCollection to change a value in that row
will still function perfectly. It seems that the row is not inserted
until the function is completely done, simply having something call a
value from the new row will not work as it simply isn't in yet. I feel
like this is a bit confusing so I'll go ahead and post my code complete
with debug functions I wrote to try and figure this out:

private function dragToOrders(event:DragEvent):void
{
 var draggedItems:Object = new Object();
 draggedItems =  event.dragSource.dataForFormat(items);
 var n:int = orderDetailArray.length;
for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
{
  if (orderDetailArray[i].ProductID == draggedItems[0].ProductID)
   {
 orderDetailArray[i].Qty ++;
 orderDetailArray.itemUpdated(orderDetailArray[i].Qty);
 trace(Fire update statement on  + i);
 tryUpdate(i);
 event.preventDefault();
 return;
   }
}
trace(Inserted New Record in  + i);
tryInsert(i);
}
private function tryInsert(row:int):void
{
 try
 {
 trace(Value of Product:  + orderDetailArray[row].ProductID + 
was inserted at  + row);
 }
 catch(ex:Error)
 {
 if(orderDetailArray.length  0)
 {
 trace(orderDetailArray[--row].ProductID);
 }
 trace(ex.toString());
 trace(--\n +
 ex.getStackTrace() +\n+
 --);
 }
}
private function tryUpdate(row:int):void
{
 try
 {
 trace(Value of Product:  + orderDetailArray[row].ProductID + 
was updated at  + row);
 }
 catch(ex:Error)
 {
 if(orderDetailArray.length  0)
 {
 trace(orderDetailArray[row--].ProductID);
 }
 trace(ex.toString());
 trace(--\n +
 ex.getStackTrace() +\n+
 --);
 }
}

As usual, thanks in advance, any and all suggestions are greatly
appreciated.

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Re: Problem with getting most recently inserted ArrayCollection item

2008-06-18 Thread bredwards358
I've had a thought, would it be possible to add an event listener to
well, something that would fire the insert function on dragComplete?
If not then perhaps would it be best to call a function which compares
the data to already existing data either in the database through
select statements or against another arrayCollection somehow? I'm just
throwing ideas around to help find a solution to my issue.



[flexcoders] Re: Help me understand custom drag/drop events(Solved)

2008-06-17 Thread bredwards358
Okay, I believe my problem is solved, I never did think that after I got
my first programming job that I would have moments where I felt like a
complete and utter moron sometimes. While experimenting with where to
put the placeholder trace statements which stand in for the actual
function calls to either insert or update database records, I discovered
just the right spot to put the insert function call as demonstrated in
this code:

private function dragToOrders(event:DragEvent):void
{
 var draggedItems:Object = new Object();
 draggedItems =  event.dragSource.dataForFormat(items);
 var n:int = orderDetailArray.length;
for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
{
  if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
   {
 orderDetailArray[i].Qty ++;
 orderDetailArray.itemUpdated(orderDetailArray[i]);
 trace(Fire update statement on  + i);//Placeholder for
update function call
 event.preventDefault();
 return;
   }
}
trace(Inserted New Record);//Placeholder for insert function
call
}

In this final incarnation when debugged, the insert statement as
represented by the trace statement is fired only when a new item is
dragged and dropped onto the target, and the update statement as
represented by its trace statement works just fine as well. If anyone
finds any problems with this, then please don't hesitate to let me know.

Brian Ross Edwards
Tech-Connect LLC




[flexcoders] Re: Help me understand custom drag/drop events

2008-06-16 Thread bredwards358
--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Why not just set a flag instead of calling preventDefault, then check
 the flag afterwards.
 
  
 
 BTW, you shouldn't be dispatching COLLECTION_CHANGE yourself.  Best to
 use itemUpdated when changing quantity.  A COLLECTION_CHANGE will fire
 when the default code inserts the dropped items.
 

I was beginning to think of something along the same lines, by flag I
assume you mean something like a boolean variable going from true to
false depending on what happened? Also, about the COLLECTION_CHANGE
event dispatching, it really doesn't matter since I need the new
values to be displayed anyway when new items are inserted anyway, but
if itemUpdated works better then I'll give that a shot. Again, thanks
for the help I really appreciate it.



[flexcoders] Re: Help me understand custom drag/drop events

2008-06-14 Thread bredwards358
I do want the dragged items inserted into the DP, I just want to add a
function call to the end of that which inserts the new row into a
local database table. My problem is that the for-loop which checks for
duplicate entries and merely prevents the default event and updates a
value in the DP makes it difficult to do what I want without doing it
for every row in the DP. Here's what I have thus far:

private function dragToOrders(event:DragEvent):void
{
var draggedItems:Object = new Object();
draggedItems = event.dragSource.dataForFormat(items);
var n:int = orderDetailArray.length;
for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
{
if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
{
orderDetailArray[i].Qty ++;
event.preventDefault();
adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
trace(Update fired);//Placeholder foractual update
function
return;
}
adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
trace(Insert fired); //Placeholder for actual insert
function
}
}

Works well and perfect for just putting new items into the data
provider and updating current ones, but while I can update items in
the both the DP and the database just fine, I just can't figure out
where to put the function call to my insert function to put a new row
in the DB. So basically I figured early Friday was to see if it was
possible to modify the default event ever so slightly, to call the
insertToDataBaseFunction(); right after the normal behavior of
inserting it into the dataProvider.

Looks simple, problem is, I'm just not sure where to start.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 IIRC, the DragDrop event is the right place and you were already doing
 that.  If you don't preventDefault that event, it will insert the
 dragged items into the DP.  I haven't been paying close attention so I'm
 not clear what problem you ran into that makes you think this isn't the
 way to go.
 
  




[flexcoders] Re: Need some assistance with dynamic updates done through a loop

2008-06-13 Thread bredwards358
Ok, one thing I'm going to try today is this; essentially I'm going to
say, forget that for-loop, just let it update the dataProvider. What
I'm going to do is write another function that runs each row of the dp
through a filterFunction and checks to see if it is there or not, if
it is there, then update the editable values, if not, then insert a
new row. Since this would be invoked after the dataProvider update, I
may just save it until the user closes the window in any way and then
run this as a save and quit function. It would also help to be able to
have it available in a button.

If anyone has a better idea on how to do this, don't hesitate to tell me.



[flexcoders] Help me understand custom drag/drop events

2008-06-13 Thread bredwards358
Shortly after posting an update to my current predicament in this
topic thread:

http://tech.groups.yahoo.com/group/flexcoders/message/116030

and staring at the current logic in my dragDrop event(Shown in above
mentioned topic), I realized something. I don't need to do anything
else other than modify the default drop event to insert new records
into my local database and not have to mess with the for-loop that
updates existing items. However, despite looking through(and still
looking at) posts on this board and pages in my book, I'm still unsure
of how to go about modifying the default drop event (or making a
custom one if that's not possible). Basically all I want to do is add
a database insert function invocation to the default event. Like I
said I'm having trouble understanding where to start so if this sounds
vague, let me know so I can help clear this up. A point in the right
direction of the breifest of tutorials on making custom drag/drop
events, a forum post containing similar subject matter, or an
explanation of where to begin would be most helpful. Thanks in advance,

Brian Ross Edwards 
Tech-Connect LLC



[flexcoders] Re: Help me understand custom drag/drop events

2008-06-13 Thread bredwards358
I'm not sure I get what you're saying but it seems that if I want to
alter the default behavior to insert the new row to the database as
well as the target dataProvider as it normally does I would probably
need a custom DragManager to add that bit. Perhaps I could be phrasing
my question wrong, since all I need to know is where to start coding
it so that along with the default behavior of putting the dragged item
into the target dataProvider, it calls a function to insert it into
the database if it doesn't already exist in which case,
event.preventDefault is called in the for loop.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Event properties should be thought of as read-only.  Drag/Drop events
 are dispatched by the DragManager so to alter what gets dispatched would
 probably require a custom DragManager which isn't officially supported.
 I suppose you could intercept and re-dispatch events using capture
 phase, stopImmediatePropagation and what not, but it seems like
 overkill.
 
  
 
 Typically, you catch the event, and if you don't want default behavior
 you call preventDefault().  Since the default behavior is insert, you
 shouldn't call preventDefault if you want insert, and only if you're
 going to block the insert and modify the quantity.
 
  
 
 




[flexcoders] Need some assistance with insert, update done in a loop

2008-06-12 Thread bredwards358
In the part of my application that I'm currently working on I'm trying
to dynamically update a local database every time a change is made to
the dataProvider(ArrayCollection) when a dragDrop action is done. Here's
my code so far:
---
private function dragToOrders(event:DragEvent):void
{
 var draggedItems:Object = new Object();
 draggedItems =  event.dragSource.dataForFormat(items);
 var n:int = orderDetailArray.length;
for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
{
  if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
   {
 orderDetailArray[i].Qty ++;
 event.preventDefault();
 adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
 trace(Update fired);//Placeholder foractual update
function
 return;
   }
   adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
   trace(Insert fired); //Placeholder for actual insert
function
}
}
---
The problem is that both the insert and update functions are firing
once the second item is put into the dropTarget's dataProvider which
would cause many duplicate entries into the database. What I need help
with is making sure that only an insert or an update is fired when
needed. I suspect this may have something to do with the for loop
everything is in but outside input would be appreciated. Thanks in
advance,

Brian Ross Edwards
Tech-Connect LLC




[flexcoders] Re: Need some assistance with dynamic updates done through a loop

2008-06-12 Thread bredwards358
Okay, after doing some more research I found that the update
function(my trace placeholder) is fine where it is, the problem is
that it is firing the insert function for each and every row every
time something is dragged onto the datagrid essentially cloning all
the entries in the database while updating the original items. So I've
narrowed down my problem to figuring out how to get the insert
function to fire only once for new items and skipped when updating
items. I keep thinking that perhaps I might be using the wrong kind of
loop, but other options I can think of amount to the same thing.

I've tried using an else and else if block to enclose the insert
placeholder but it is still doing the same thing. Again, any advice
and help would be greatly appreciated.

--- In flexcoders@yahoogroups.com, bredwards358 [EMAIL PROTECTED]
wrote:

 In the part of my application that I'm currently working on I'm trying
 to dynamically update a local database every time a change is made to
 the dataProvider(ArrayCollection) when a dragDrop action is done. Here's
 my code so far:
 ---
 private function dragToOrders(event:DragEvent):void
 {
  var draggedItems:Object = new Object();
  draggedItems =  event.dragSource.dataForFormat(items);
  var n:int = orderDetailArray.length;
 for (var i:int = 0; i  n; i++)//Looping through to check for
 duplicate entries
 {
   if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
{
  orderDetailArray[i].Qty ++;
  event.preventDefault();
  adgOrders.dataProvider.dispatchEvent(new
 CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
  trace(Update fired);//Placeholder foractual update
 function
  return;
}
adgOrders.dataProvider.dispatchEvent(new
 CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
trace(Insert fired); //Placeholder for actual insert
 function
 }
 }
 ---
 The problem is that both the insert and update functions are firing
 once the second item is put into the dropTarget's dataProvider which
 would cause many duplicate entries into the database. What I need help
 with is making sure that only an insert or an update is fired when
 needed. I suspect this may have something to do with the for loop
 everything is in but outside input would be appreciated. Thanks in
 advance,
 
 Brian Ross Edwards
 Tech-Connect LLC





[flexcoders] Seeking Advice regarding saving changes

2008-06-10 Thread bredwards358
In the application I am working on, the user can drag and drop items
from one datagrid to another. Now regardless of how the user exits the
window, the data is always saved. My question is basically, what would
be the best strategy for saving these changes. The dataProviders for
both grids are array collections populated with info gathered from a
local database. I can think of two ways to do this thus far, both can
work as far as I can tell.

Strategy 1: Wait for the user to close out the window and then save
all the changes at once. For a new order, this is as simple as a loop
through the array collection and doing an insert for each row. However
for updating orders, I'm not sure but is it possible to check for
changed values while looping through and then doing an update for the
changes? I see the itemChanged property and it looks like the thing I
need. This is in my opinion the toughest to implement if just for the
update functionality.

Strategy 2: On every dragDrop event, on every change in the
itemRenderers, do either an insert or an update statement depending on
whether a new item is dropped in, or being updated. This to me seems
like the more practical solution and what I am considering at the moment. 

Thoughts? Opinions? Thanks in advance.

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Re: Seeking Advice regarding saving changes

2008-06-10 Thread bredwards358
Okay, that's a lot of code to take in but thanks that should be very
helpful. So far my ideas have been revolving around my second
strategy, which I am considering using a modified version of this code
for the drag and drop stuff. I only need to  figure out the right
places to put the functions I need to perform the insert/update
statements. Item renderers will simply call the needed functions.

--
private function dragToOrders(event:DragEvent):void
{   
var draggedItems:Object = new Object();
draggedItems =  event.dragSource.dataForFormat(items);
var n:int = orderDetailArray.length;
   for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
   {
 if (orderDetailArray[i].UniqueID == draggedItems[0].UniqueID)
  {
orderDetailArray[i].Qty ++;
event.preventDefault();
adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE));
return;
  }  
  adgOrders.dataProvider.dispatchEvent(new
CollectionEvent(CollectionEvent.COLLECTION_CHANGE)); 
   }
}
--

I'm not exactly sure of the right spot to put the function(s) to
modify the dataProvider and the database using its items.



[flexcoders] Re: dragDrop function working, but not properly

2008-06-05 Thread bredwards358
It is unfourtunately, even if it is being set to 0 it keeps
incrementing itself along with the growing dataProvider of the
dropTarget, I think I may have done something wrong to where it is not
seeing the identical values of the duplicate entry and is simply going
forward.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 I'd double check.  The for loop must be starting with I == 0.  It can't
 be starting at 1.
 
  
 
 




[flexcoders] Re: dragDrop function working, but not properly

2008-06-05 Thread bredwards358
I believe I fixed my problem, I think the reason it wasn't seeing the
identical value in the array representing the dragged item was because
it did not know it's index so I changed this:
---
private function dragToOrders(event:DragEvent):void
{
 try
 {
 var draggedItems:Object = new Object();
 draggedItems =  event.dragSource.dataForFormat(items);
 var n:int = orderDetailArray.length;

for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
{
  if (orderDetailArray[i].ProductID == draggedItems.ProductID)
   {
 orderDetailArray[i].Qty ++;
 event.preventDefault();
 return;
   }
}
 }
 catch(ex:Error)
 {
 trace(ex);
 trace(ex.getStackTrace());
 }
}
---
To this:
---
private function dragToOrders(event:DragEvent):void
{
 try
 {
 var draggedItems:Object = new Object();
 draggedItems =  event.dragSource.dataForFormat(items);
 var n:int = orderDetailArray.length;

for (var i:int = 0; i  n; i++)//Looping through to check for
duplicate entries
{
  if (orderDetailArray[i].ProductID == draggedItems[0].ProductID)
   {
 orderDetailArray[i].Qty ++;
 event.preventDefault();
 return;
   }
}
 }
 catch(ex:Error)
 {
 trace(ex);
 trace(ex.getStackTrace());
 }
}
---
No errors thrown, no duplicate entries, however when I trace the value
of orderDetailArray[i].Qty I get NaN which I assume means Not a
Number what I'm guessing here is that it is trying increment from a
null value which is of course, Not a Number. So I think all that's
needed then is to simply put in a default value of 1 for the first entry
in the dataProvider.


[flexcoders] dragDrop function working, but not properly

2008-06-04 Thread bredwards358
I finished a working dragDrop function today, but ran into a bit of a
problem, this is what I have so far, my problem is highlighted in the
comments

private function dragToOrders(event:DragEvent):void
{
 try
 {
 var draggedItems:Object = new Object();
 draggedItems =  event.dragSource.dataForFormat(items);
 var n:int = orderDetailArray.length;

for (var i:int = 0; i  n; i++)
{
//The UnigueID of the dragged items will always remain the
same
//but after the first item is added to the dataProvider of
the dragTarget,
//the variables i and n will always start incremented from
the last insert,
//allowing for duplicate items and not incrementing the Qty
column
  if (orderDetailArray[i].UniqueID == draggedItems.UniqueID)
   {
 orderDetailArray[i].Qty ++;
 event.preventDefault();
 return;
   }
}
 }
 catch(ex:Error)
 {
 trace(ex);
 trace(ex.getStackTrace());
 }
}

As you can see, and as I can see while in the debugger, after the first
item is in the drag target's provider, if I try to add the same item it
will put in a duplicate entry since while the UniqueID of the item I'm
dragging will remain the same, variables i and n will start incremented
from the previous insert. For example, if i and n were 0, after the
first item, they will begin at 1. Of course this means I'm not getting
the correct index being checked when I insert a new item, my question is
how to fix it as I'm not exactly sure at this time. Thanks in advance.

Brian Ross Edwards
Tech-Connect LLC


[flexcoders] Re: Questions regarding updating dataProviders after a drag drop

2008-06-03 Thread bredwards358
Ok, going with the idea of creating a class called Product, since it
seems to be referencing the first index of the draggedItems array,
would this be an object type class? Or an array since we're adding to
the dataProvider which is an arrayCollection?

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 I thought you were dragging Products
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of bredwards358
 Sent: Monday, June 02, 2008 7:18 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Questions regarding updating dataProviders
 after a drag  drop
 
  
 
 
 --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote:
 
  Normally, you listen for dragDrop or dragComplete events and if you
  don't want default behavior, you call preventDefault on the event and
 do
  whatever you want.
  
  
  
  So, if I were handling dragging products to a shopping list, I would
  write something like this:
  
  
  
  public function dragDropHandler(event:DragEvent):void
  
  {
  
  var draggedItems:Array =
  event.dragSource.dataForFormat(items);
  
  var draggedItem:Product = draggeItems[0];//Also, what is this Product
 data type? I don't quite understand where this comes from
 





[flexcoders] Re: Questions regarding updating dataProviders after a drag drop

2008-06-02 Thread bredwards358
Okay, I kind of get what you're saying, it makes sense however I have
some questions to clear things up further, nothing big, just simple
things. Check below for the blue text, in the meantime I'll experiment,
Thanks a bunch I appreciate it.

Brian Ross Edwards,
Tech-Connect LLC.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Normally, you listen for dragDrop or dragComplete events and if you
 don't want default behavior, you call preventDefault on the event and
do
 whatever you want.



 So, if I were handling dragging products to a shopping list, I would
 write something like this:



 public function dragDropHandler(event:DragEvent):void

 {

 var draggedItems:Array =
 event.dragSource.dataForFormat(items);//Is items simply a generic
name or the name of what you're dragging from?

 var draggedItem:Product = draggeItems[0];//Am I correct in
assuming that this is the row of the dataGrid being dragged from?



 // search array collection for existing object

 var ac:ArrayCollection = dataProvider;//This is the
dataProvider of the dataGrid being dropped on, right?

 var n:int = ac.length;

 for (var i:int = 0; I  n; i++)

 {

 If (ac[i].productKey ==
draggedItem.productKey)

 {

 ac[i].quantity ++;

 event.preventDefault();

 return;

 }

 }

 // if we don't exit via preventDefault()/return, then
 default behavior will add it to the dataProvider

 }




[flexcoders] Re: Questions regarding updating dataProviders after a drag drop

2008-06-02 Thread bredwards358
I am but its not its own data type, unless I need to declare a new
class or public variable within an already existing class to hold the
row from the dragSource. Either would work for me.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 I thought you were dragging Products
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of bredwards358
 Sent: Monday, June 02, 2008 7:18 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Questions regarding updating dataProviders
 after a drag  drop
 
  
 
 
 --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote:
 
  Normally, you listen for dragDrop or dragComplete events and if you
  don't want default behavior, you call preventDefault on the event and
 do
  whatever you want.
  
  
  
  So, if I were handling dragging products to a shopping list, I would
  write something like this:
  
  
  
  public function dragDropHandler(event:DragEvent):void
  
  {
  
  var draggedItems:Array =
  event.dragSource.dataForFormat(items);
  
  var draggedItem:Product = draggeItems[0];//Also, what is this Product
 data type? I don't quite understand where this comes from
 





[flexcoders] Questions regarding updating dataProviders after a drag drop

2008-05-30 Thread bredwards358
Looking through the posts regarding my search criteria of drap and drop
and Array collection, I couldn't find a post which cleared up the task
of updating a data provider, in this case, an array collection, after an
item is dragged to its datagrid from another. Purely using the default
settings(no code other than the settings in the MXML tags), I can drag
an object from one grid to another and have that item appear perfectly
in there barring a few things I plan to add after the fact. What I'm
guessing, and please correct me if I'm wrong, but I would need to invoke
an event through the dragDrop or dragComplete events? Also would I be
correct to assume that the skeleton of such a function would look like
this?

private function dragToOrders(event:DragEvent):void
{
 //Insert whatever logic to happen when the event happens
}

Where I'm getting stuck the most is the logic inside that skeleton, I
have a rough idea on what would happen with this:

orderDetailArray.addItem(/*What represents the item being dragged?*/);
orderDetailArray.Refresh();

Would this be at least close to correct? Also, since the items being
dragged are products, I'd need to find a way to simply increment a field
in the dataprovider instead of adding another row of the exact same
thing, though I believe this is a simple check to see if the item being
added is the same as something already in the arraycollection via a
loop.

If this seems vague then place let me know so we can clear this up,
also, pointers to posts I may have missed, blogs or tutorials on similar
subject matter would help. Thanks in advance,

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] Working with SQL Lite Indexing and how it always starts at '1'

2008-05-29 Thread bredwards358
In the AIR application I'm developing, I'm using a local SQL Lite
database, it's been working well, however, after a bit of refactoring, I
came across this error:

RangeError: Index '1' specified is out of bounds.

In this case, '1' is the index of the very first item in the datatable,
automatically incremented from '0' when the very first item was first
entered in the previously empty datatable. However when the index of the
selected item is taken from the very first item of the dataGrid's
dataProviders(ArrayCollections), they read as '0' which is usually the
first index of just about anything. Here's a snippet of code where the
error usually occurs:

public function newEdit():void
{
 chosenMode = Edit;
 currentState=Edit Item;
 this.deleteCol.visible = false;
 this.editCol.visible = false;
 this.btnNew.enabled = false;
 this.btnExit.enabled = false;
 this.txtName.text = ;
 this.txtID.text = ;
 selectedItemIndex =
this.dgUsage_Locations.selectedItem.UniqueID;//Generally turns out to be
'1'
 uniqueID =
useLocDataProvider.getItemAt(selectedItemIndex).UniqueID;//When taken
from the datatable it is '0'
 this.txtID.text =
useLocDataProvider.getItemAt(selectedItemIndex).UseLocationID;
 this.txtName.text =
useLocDataProvider.getItemAt(selectedItemIndex).UseLocationName;
}

I can think of a few workarounds for this problem, such as incrementing
the value taken from the dataProvider since it seems like it will always
be one lower than what is actually in the database, or I can simply code
it so that the first entry entered into the datatable is always 0,
however I'm not sure that either of these will work 100%. So any
suggestions to solve this issue would be helpful. Thanks in advance.

Brian Ross Edwards
Tech-Connect LLC.



[flexcoders] Re: Working with SQL Lite Indexing and how it always starts at '1'

2008-05-29 Thread bredwards358
Okay, I discovered the solution to my problem. All I had to do was just
check the length of the dataProvider before doing an insert, if the
length of the arraycollection was 0(no entries) then it would amend the
insert statement to insert a zero into the primary key column. If the
length was anything but zero, it would insert the statement normally,
allowing the primary key column to increment normally. Here's the code I
used to do this:

providerLength = model.prodMaintData.length;
 if(providerLength == 0)
 {
 sqlText = INSERT INTO Up18Products(UniqueID, ProductID,
ProductName, Barcode, ReorderUnit, ReorderQty, Vendor, 
  + Cost, ListCost, Class, Billable, Status,
ToPrint, DateImported, DateUpdated, +
 RptQtyUsed, RptPercentUsed) +
 VALUES(0, :productID, :productName, :Barcode,
:reorderUnit, :reorderQty, :Vendor, :Cost, :listCost, :Class, +
 :Billable, :Status, :toPrint, :dateImported,
:dateUpdated, +
 :rptQtyUsed, :rptPercentUsed);
 }
 else
 {
 sqlText = INSERT INTO Up18Products(ProductID, ProductName,
Barcode, ReorderUnit, ReorderQty, Vendor,  +
 Cost, ListCost, Class, Billable, Status, ToPrint,
DateImported, DateUpdated, +
 RptQtyUsed, RptPercentUsed) +
 VALUES(:productID, :productName, :Barcode,
:reorderUnit, :reorderQty, :Vendor, :Cost, :listCost, :Class, +
 :Billable, :Status, :toPrint, :dateImported,
:dateUpdated, +
 :rptQtyUsed, :rptPercentUsed);
 }

The rest you can probably guess. So far this seems to work perfectly, if
for any reason you don't think it will in the future, don't hesitate to
tell me.



[flexcoders] Re: filterFunction problems being had

2008-05-23 Thread bredwards358
I kind of see what you're getting at, I'm thinking the ArrayCollection
is probably not being returned as an associative array. I've
double-checked and the col variable is containing the value of what
I select in the comboBox yet value is not getting set equal to it so
yeah value = item[col] works. Going by your suggesting of checking the
field names, and all I had to do was make sure they matched and when
they did, the function as a whole worked. 

Thanks, once again a mundane detail ruins my day, lol. Oh well, all
part of the learning process.

--- In flexcoders@yahoogroups.com, Tim Hoff [EMAIL PROTECTED] wrote:

 
 Hi Brian,
 
 The original example uses an associative array; which is an instance of
 the Object class.  Because the example creates it's ArrayCollection in
 code, value = item[col] works:
 
 dpRows = new ArrayCollection();
 var item:Object = new Object();
 item.type = Website;
 item.name = Expectal.com;
[EMAIL PROTECTED], bredwards358 bredwards358@
 wrote: item.url = http://www.expectal.com;;
 item.desc = Your Professional Flash Photo Gallery with Slideshow and
 Background Music;
 item.tags = Flash, Gallery, Slideshow, Music;
 dpRows.addItem(item);
 
 However, if you are loading your DataGrid's ArrayCollection from a
 database, it's probably not being returned in an associative array
 format.  If it is, check to make sure that the field names are exactly
 the same as the data values in the ComboBox ArrayCollection.  If it's
 not, you will probably have to re-write the code to be conditional.  You
 might also want to debug the col variable; to make sure that it
 contains a value.
 
 As a general recommendation, I would pay attention to naming
 conventions.  Filters and Sorts are two distinctly different functions
 that may be applied to an ArrayCollection. 
 (model.prodMaintData.filterFunction = sortProducts is confusing).  Also,
 I would stay away from using the word data in name/value pairs.  It
 works, but it's very close to being a reserved word in Flex.
 
 -TH



[flexcoders] Help me understand how to manipulate dataProviders

2008-05-23 Thread bredwards358
After doing some research which consisted mainly of searching through
this forum, I noticed a mantra along the lines of manipulate the
dataProvider, not the controls it populates. It makes sense,
especially since without directly manipulating the primary key of the
very first entry in a database , it will read as 1, while the first
index of a dataGrid will read as 0. Right now, I have a mostly
finished AIR form which serves as a way of maintaining a product
table. The dataGrid's provider is an array collection built from the
results of a select statement. To get to the point I'd like some
assistance in streamlining some things to not onlt help this form, but
others in the application which will use the same data access
functionality. For starters, here's how I update data:
Assume that the first primary key in the very first entry of the
database has been edited to read as 0 after it was entered so it syncs
up with the dataGrid.selectedIndex property.

//Begins the proceedure to edit a currently existing item when the
edit button is clicked
public function newEdit():void
{
chosenMode = Edit;
currentState = Edit Item;
editColumn.visible = false;
deleteColumn.visible = false;
duplicateColumn.visible = false;
this.lblUniqueID.visible = false;
this.rbAll.visible = false;
this.rbBillable.visible = false;
this.rbNonBillable.visible = false;
try
{
var selectedItemIndex:int = adgProducts.selectedIndex;
//Uses another select statement to get the needed information and
passes the results into
//variables which populates the controls instead of an arrayCollection
dataManager.selectProdDataForEdit(selectedItemIndex);
this.lblUniqueID.text = model.editVarOne;
this.txtNewProductID.text = model.editVarTwo;
this.txtNewProductName.text = model.editVarThree;
this.txtNewBarcode.text = model.editVarFour;
this.txtNewUnit.text = model.editVarFive;
this.txtNewQuantity.text = model.editVarSix;
this.txtNewVendor.text = model.editVarSeven;
this.txtNewCost.text = model.editVarEight;
this.txtNewList.text = model.editVarNine;
this.chkNewBillable.selected = model.editVarBool;
this.lblCurrentStatus.text = Currently  + model.editVarEleven;
}
catch(ex:Error)
{
trace(ex.toString());
trace(ex.getStackTrace());
}
}
private function saveItem(mode:String):void//Differentiates between
whether you want to insert a new item or edit an existing one
{
switch(mode)
{
case Add_New: insertNew();
break;
case Edit: editItem();
break;
default: Alert.show(Cannot Determine State,State Unknown)
break;
}
}
//Actually edits an existing item when the save button is clicked
private function editItem():void
{//Takes the information from the controls and sets them equal to
global variables of the same type which
//are then passed into the function which performs the update
model.insertStringOne = this.txtNewProductID.text;
model.insertStringTwo = this.txtNewProductName.text;
model.insertStringThree = this.txtNewBarcode.text;
model.insertStringFour = this.txtNewVendor.text;
model.insertIntOne = parseInt(this.txtNewUnit.text);
model.insertIntTwo = parseInt(this.txtNewQuantity.text);
model.insertNumberOne = Number(this.txtNewCost.text);
model.insertNumberTwo = Number(this.txtNewList.text);
model.insertStringFive = this.cmbNewClass.selectedItem.toString();
model.insertBooleanOne = this.chkNewBillable.selected;
model.insertStringSix = this.cmbStatus.selectedLabel.toString();
model.insertIntThree = parseInt(this.lblUniqueID.text);

dataManager.updateProduct(model.insertStringOne,
model.insertStringTwo, model.insertStringThree, model.insertIntOne,
model.insertIntTwo, model.insertStringFour, model.insertNumberOne,
model.insertNumberTwo, model.insertStringFive,
model.insertBooleanOne, model.insertStringSix, model.insertNewDate,
model.insertIntThree);

cancelOperation();
//Refreshes the datagrid
refreshGrid();
}

What I want is to see if there's an easier way to do this via
accessing the ArrayCollection model.prodMaintData to get the values to
edit as opposed to going through another select statement as well as
some other things that might help. I don't totally understand the
functions associated with the ArrayCollection or at least what needs
to be passed into them to get what I need. Thanks in advance.

Brian Ross Edwards
Tech-Connect LLC



[flexcoders] filterFunction problems being had

2008-05-22 Thread bredwards358
Okay, I'm working on a filter function to sort through information in an
ArrayCollection which is filled by the results of a select statement to
a database. The actual functionaility is modified ever so slightly from
the source I found here:

http://www.franto.com/blog2/wp-content/uploads/examples/filterfunction/s\
rcview/

This is what I have:

private function filterProducts():void
{
 model.prodMaintData.filterFunction = sortProducts;
 model.prodMaintData.refresh();
}

private function sortProducts(item:Object):Boolean
 {
 var value:String;
 var col:String = this.cmbColumns.selectedItem.data as String;
 searchBy = this.txtDescription.text;

 searchBy = searchBy.toLowerCase();

 if (searchBy != )
 {
 if (col != any)
 {
 value = item[col]; //Why is value NOT getting set
equal to this?
 value = value.toLowerCase(); //Error happens here
because value is still null for some reason

 if (value.indexOf(searchBy) = 0)
 {
 return true;
 }
 }
 else
 {
 for (var o:String in item)
 {
 value = item[o];
 value = value.toLowerCase();
 if (value.indexOf(searchBy) = 0)
 {
 return true;
 }
 }
 }
 }
 else
 {
 return true;
 }

 return false;
 }


Now, as seen by my comments, I keep getting an error because the value
variable is null for some reason, even when lines were changed around
from what was originally from the sample. I don't know if this has
anything to do with it, but despite the fact that my comboBox is
populated by an ArrayCollection that was declared and filled manually in
the code:


columnArray = new ArrayCollection();
 columnArray.addItem({data:'any', label:'Any'});
 columnArray.addItem({data:'productID', label:'Product ID'});
 columnArray.addItem({data:'productName', label:'Product
Name'});
 columnArray.addItem({data:'print', label:'Print'});
 columnArray.addItem({data:'barcode', label:'Barcode'});
 columnArray.addItem({data:'vendor', label:'Vendor'});
 columnArray.addItem({data:'status', label:'Status'});


The ArrayCollection which populates the dataGrid, the one I'm trying to
sort through, is instantiated and populated automatically again from a
database table. I don't see the reason why the value variable should be
null and causing the error. Thanks in advance.

Brian Ross Edwards



[flexcoders] Re: Help me understand the datagrid

2008-05-21 Thread bredwards358
Forgive the lateness of my response, but thanks all, I solved my
problem, I didn't need to do item editing inside the datagrid at all,
I simply needed to just be able to edit an item. I simply made a state
of the window which contains a form populated with the necessary
information. But what I read so far gave me some great insight into
using the datagrid including how to manipulate individual columns, (it
didn't occur to me to give the columns an id).

Thanks a bunch, it's been elightening.



[flexcoders] Help me understand the datagrid

2008-05-20 Thread bredwards358
Now, I've been coding in flex for about six or seven weeks now and
things seem to be going swimmingly so far, until I now have to climb
the brick wall that is trying use more of the functions of the data
Grid or actually the advanced data Grid than I was ever used to. Given
the sheer number of topics on the subject I imagine my plight is
pretty common. Until recently I typically used a data Grid to display
information, now that I've become aware of its more intuitive
functions such as inline item renderers.

My main problem so far is this. I have a window which brings up an
initial data grid full of products drawn from a SQL Lite database
table. The data provider for the grid is an ArrayCollection containing
the results of the select statement. At the far left of the grid, are
two button columns added via itemRenderers, one for removing a product
entry, another for editing a currently existing item. I can do the
logic for the actual updating and deleting to the database, but
correct me if I'm wrong as I believe that I simply need to execute the
statement where the primary key is equal to the selected index of the
datagrid, however modified via increment since the grid index is one
behind the table as I've noticed.

Anyhoo, I am aware of the outerDocument.whateverFunction(); deal with
controls made with itemRenderer but it doesn't work in my case since
all of the actionscript in my documents is in a .as file separate from
the .mxml file and referred to as the source in the mx:script/ tag.
I try to use outerDocument and I get the error:

1061: Call to a possibly undefined method editItem through a reference
with static type Product_Maintenance.

So what can I do to get at the function inside the .as file? I've
tried simply placing a script tag within the itemRenderer but it
throws a parse error regardless of whats inside.



[flexcoders] Re: Help me understand the datagrid(Item Renderers and column manupilation)

2008-05-20 Thread bredwards358
Sorry, small bit I forgot, I also have columns which are invisible by
default and need to make them visible during runtime, seems like
there's no way to directly access the properties of individual columns
though I think I'm probably wrong since I'm thinking there's got to be
a way to access the index of the column in question.



[flexcoders] Re: SQL Lite syntax issue, need something cleared up regarding SELECT

2008-05-19 Thread bredwards358
--- In flexcoders@yahoogroups.com, Marcus Engene [EMAIL PROTECTED] wrote:

 And then google for sql injection.

Already taken care of beforehand, I find to be a bit of an annoyance
when the solution to so many problems turn out to be incredibly
simple, apparently too simply for me to readily find. Oh well all a
part of learning, Thanks everyone I really appreciate your assistance.
The problem did indeed turn out to be an issue with the parameters I
was throwing in and what to throw around them.



[flexcoders] SQL Lite syntax issue, need something cleared up regarding SELECT

2008-05-16 Thread bredwards358
While working on the login functionality of the application I'm
developing, I noticed that SQL seems to be interpereted differently
than what I'm used to. Here's my current select statement that I'm
using for validation:

sqlText = SELECT * FROM Up18Technicians WHERE TechName =  + userName
+  AND Password =  + pass;

Which translates to:

SELECT * FROM Up18Technicians WHERE TechName = Ross AND Password = 358029

Now, when the application gets to the execute portion, it throws this
error:

SQLError: 'Error #3115: SQL Error.', details:'no such column: Ross',
operation:'execute'
at flash.data::SQLStatement/internalExecute()
at flash.data::SQLStatement/execute()
at
MatMgr::DataManager/techLogin()[C:\Tech_Connect\MatMgr_Proto\src\MatMgr\DataManager.as:453]
at
MatMgr_Proto/login()[C:\Tech_Connect\MatMgr_Proto\src\MatMgrProtoSource.as:210]
at
MatMgr_Proto/__btnLogin_click()[C:\Tech_Connect\MatMgr_Proto\src\MatMgr_Proto.mxml:18]

This indicates that it is trying to find columns by the name of what
was entered instead of trying to find values in those columns matching
what I entered. I looked up SQL as its understood by SQL lite, but it
seems a bit confusing and I'm unsure if it's even the problem. If it
is, then I'm just wondering if it may have something to with perhaps
the AND keyword isn't understood or maybe there's something up with
how I'm using the WHERE clause.

Here's the function I'm using to perform this in case it helps:

public function techLogin(userName:String, pass:String):void
{ //This loads information needed to login technicians
sqlText = SELECT * FROM Up18Technicians WHERE TechName =  +
userName +  AND Password =  + pass;
trace(sqlText);
selectStatement = new SQLStatement();
conn = new SQLConnection();
selectStatement.sqlConnection = conn;
conn.open(dbFile);
selectStatement.addEventListener(SQLEvent.RESULT, 
selectTechLoginResult);
selectStatement.addEventListener(SQLErrorEvent.ERROR, errorHandler);
selectStatement.text = sqlText;
selectStatement.execute(); //Error happens here, doesn't go any further
}



[flexcoders] ComboBox Data Display woes, Getting [object Object] instead of what I need

2008-05-15 Thread bredwards358
The AIR application that I'm currently developing, gets its data from
a SQL Lite database and does it through whatever select statement it
needs which then puts the results into an array collection variable
which is then passed into the dataProvider for the control. So far,
its just been data grids, but when I try to put the array collection
variable into a combobox, I get this when I trace it:

[object Object],[object Object],[object Object]

I get the same result when I trace it on a data grid so I know that
it's working properly, I'm guessing something's not being liked when
it comes to combo boxes. The select statement is simply selecting one
column from the desired table. I am wondering if there is something
needed to be done to get the selected data to display properly in the
comboBox instead of [object Object],[object Object],[object Object].
More than likely I'm hoping this is something simple I'm just
overlooking, thanks in advance.

EDIT: Here's the XML tag for my comboBox

mx:ComboBox id=cmbNewClass dataProvider={model.classData}/

model.classData is the ArrayCollection which stores the data from the
insert statement



[flexcoders] Re: ComboBox Data Display woes, Getting [object Object] instead of what I need

2008-05-15 Thread bredwards358
Never mind, I did a bit of messing around and found the solution to be
that I simply had to set the labelField property to whatever column
header I was binding the box to.



[flexcoders] Re: SQL statement is not finding my table in AIR app

2008-05-13 Thread bredwards358
Never mind, I found the problem , turns out I wasn't referencing the
database file when I was opening the connection.




[flexcoders] SQL statement is not finding my table in AIR app

2008-05-12 Thread bredwards358
I've started implementing the bulk of the database logic in our
current software project, and while trying to get the select statement
to work in populating the datagrid in one window upon creation, I keep
running into this error every time the SQL statement tries to execute.
It keeps saying that the table I'm trying to get the data from doesn't
exit, when it clearly does in the database the application creates in
the event it doesn't already exist. I've checked the spelling, and
fixed my select statement, but it still says that the table doesn't
exist. Here is the code I'm using:

//Functions to load the proper window depending on what window is open

//Imported Stuff
import MatMgr.DataManager;

import flash.data.SQLConnection;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.display.NativeWindow;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;

//Code to load either the new Repair Order or new Purchase Order window

//Declared variables used in more than just one function
private var dataManager:DataManager = new DataManager();
private var loadRO:Repair_Order = new Repair_Order();
private var loadPO:PurchaseOrder = new PurchaseOrder();
private var sqlText:String;
private var selectStatement:SQLStatement;
private var conn:SQLConnection;

//Form Initialization
private function init():void
{
var appWindow:NativeWindow = this.stage.nativeWindow;
var winTitle:String = appWindow.title;
//Alert.show(winTitle, The title of the window is...);
switch(winTitle)
{
case Repair Orders: setSelectData(winTitle);
break;
case Purchase Orders: setSelectData(winTitle);
break;
}
}
//Select functions to populate the datagrid
private function setSelectData(windowTitle:String):void
{
var selectedROHeaderColumns:String = ROID, BillID, RODate, Status;
var selectedPOHeaderColumns:String = POID, PODate, TechID, Status;

switch(windowTitle)
{
case Repair Orders: sqlText = SELECT  + selectedROHeaderColumns +
 FROM Up18ROHeader;
executeSQL(sqlText);
break;
case Purchase Orders: sqlText = SELECT  + selectedPOHeaderColumns
+  FROM Up18POHeader;
executeSQL(sqlText);
break;
}
}
private function executeSQL(selectSQL:String):void
{
selectStatement = new SQLStatement();
conn = new SQLConnection();
selectStatement.sqlConnection = conn;
conn.open();
selectStatement.addEventListener(SQLEvent.RESULT, selectResult);
selectStatement.addEventListener(SQLErrorEvent.ERROR,
dataManager.errorHandler);
selectStatement.text = selectSQL;
selectStatement.execute();
}
private function selectResult(event:SQLEvent):void
{
var result:SQLResult = selectStatement.getResult();
dgOrders.dataProvider = result.data;
}




[flexcoders] Re: Need help finding and fixing SQL Error in AIR App

2008-05-01 Thread bredwards358
That's fine, I again figured something out a short while ago while
experimenting with importing the text documents. Turns out you can't
have the special characters such as the - or / in the column
header, the actual data in the rows beneath them can have those
characters. So instead of doing a massive find/replace, I just needed
to change two characters and I was good to go.


--- In flexcoders@yahoogroups.com, valdhor [EMAIL PROTECTED] wrote:

 There are a few predefined characters that can confuse XML. A good
 article to peruse is at:
 
 http://articles.techrepublic.com.com/5100-22-5032714.html
 
 '-' and '/' aren't listed.
 





[flexcoders] Re: Need help finding and fixing SQL Error in AIR App

2008-04-30 Thread bredwards358
--- In flexcoders@yahoogroups.com, valdhor [EMAIL PROTECTED] wrote:

 Nope - nothing to do with the XML.
 
 You have a comma missing between :Sheet_Depth and :Unique_Product_Code
 in your sqlText variable in your insertData function.
 
Cool, thanks for pointing that out as well. I've figured a few things
out myself. As a workaround, I decided to export the table I wanted as
a CVS document and import it into SQL Lite using a browser I
downloaded. One of the things I've noticed is that SQL Lite does not
like special characters such as - or / in what you're importing,
so after changing a few things, I got the table imported and all is well.

However, I think that along with that missing comma you pointed out,
my problem may also have something to do with trying to write these
forbidden special characters into the table. It would explain the
sheer number of errors. Thanks for everything though, to all those who
responded, I appreciate it. Another question though, just out or
curiosity, is it possible to use some sort of escape character(s) to
get those -'s and /'s into the table?



[flexcoders] Need help finding and fixing SQL Error in AIR App

2008-04-29 Thread bredwards358
So, I finish a simple application to turn an XML Document into a SQL
Lite table, however, every time I try to run it, I simply get an error
message in the error log I set up: [b]Error ID:3115 DetailsError #3115:
SQL Error.[/b] As you can see, it's simply not descriptive enough.

Going over my code, I really have no idea on where I could be doing
things wrong here, it could be something as simple as improper
formatting, but the document I'm working to convert is huge, thus making
the create table, and insert statement with just the number of columns
(34!). I'm not exactly sure where to begin here, and since posting
snippets would exceed the max size of the post I suppose I could ask for
a point in the right direction. Right now I'm thinking something is not
matching up right.

Here's a snippet from my XML document, and the statements in my app, due
to the size of the XML,  I can't post it in it's entirety since it would
exceed most message board limits.
Xml
Document Snippet
Support xmlns=http://tempuri.org/Support.xsd;
Avery
   Original3267/Original
   Product_Code3267/Product_Code
   Unique_Product_ID3267/Unique_Product_ID
   TrademarkYes/Trademark
   Patent_PendingNo/Patent_Pending
   Avery_Product_CategoryGreeting Cards/Avery_Product_Category
   Product_DescriptionWhite Full-Size Card Sheet/Product_Description
   Product_TypeCard/Product_Type
   Coated_StockYes/Coated_Stock
   Photo_Quality-/Photo_Quality
   Full_Bleed-/Full_Bleed
   Mirror_Image_Required-/Mirror_Image_Required
   Printer_TypeInkjet/Printer_Type
   Corresponding_A4_SKUC2356/Corresponding_A4_SKU
   Template_Family9/Template_Family
   Page_Size8 1/2 x 11/Page_Size
   OrientationPortrait/Orientation
   Number_of_Lbls_Cards_per_Sheet1/Number_of_Lbls_Cards_per_Sheet
   Label_Height11/Label_Height
   Label_Width8.5/Label_Width
   Corner_Radius0/Corner_Radius
   Number_Sections_Across1/Number_Sections_Across
   Number_Sections_Down1/Number_Sections_Down
   Top_Margin0/Top_Margin
   Bottom_Margin0/Bottom_Margin
   Left_Margin0/Left_Margin
   Right_Margin0/Right_Margin
   Horiz_Pitch8.5/Horiz_Pitch
   Vertical_Pitch11/Vertical_Pitch
   Sheet_Width8.5/Sheet_Width
   Sheet_Depth11/Sheet_Depth
   Unique_Product_Code3267/Unique_Product_Code
/Avery
Crea\
te Table Statement Snippet
private function createTable():void
 {
 var sqlText:String = CREATE TABLE Avery(Original TEXT,
Product_Code TEXT, Cross_Reference TEXT, Sequence NUMERIC,  +
 Unique_Product_ID TEXT, Trademark TEXT,
Patent_Pending TEXT, Avery_Product_Category TEXT,  +
 Product_Description TEXT, Priority_SKU TEXT,
Product_Type TEXT, Coated_Stock TEXT, Photo_Quality TEXT,  +
 Full_Bleed TEXT, Mirror_Image_Required TEXT,
Printer_Type TEXT, Corresponding_A4_SKU TEXT,  +
 Template_Family NUMERIC, Page_Size TEXT,
Orientation, Number_of_Lbls_Cards_per_Sheet NUMERIC,  +
 Label_Height NUMERIC, Label_Width NUMERIC,
Corner_Radius NUMERIC, Number_Sections_Across NUMERIC,  +
 Number_Sections_Down NUMERIC, Top_Margin
NUMERIC, Bottom_Margin NUMERIC, Left_Margin NUMERIC,  +
 Right_Margin NUMERIC, Horiz_Pitch NUMERIC,
Vertical_Pitch NUMERIC, Sheet_Width NUMERIC,  +
 Sheet_Depth NUMERIC, Unique_Product_Code
TEXT);

 createTableStatement = new SQLStatement();
 createTableStatement.sqlConnection = conn;
 createTableStatement.addEventListener(SQLEvent.RESULT,
createTableResult);
 createTableStatement.text = sqlText;
 createTableStatement.execute();
 }
Inse\
rt Statement Snippet



[flexcoders] Re: Need help finding and fixing SQL Error in AIR App

2008-04-29 Thread bredwards358
Here's the Insert statement snippet since it got cut off due to length:

private function insertData(node:XMLNode):void
 {//Quite possibly the biggest SQL statement I've ever done
thus far
 var sqlText:String = INSERT INTO Avery(Original,
Product_Code, Cross_Reference, Sequence, Unique_Product_ID,  +
 Trademark, Patent_Pending,
Avery_Product_Category, Product_Description, Priority_SKU, Product_Type,
 +
 Coated_Stock, Photo_Quality, Full_Bleed,
Mirror_Image_Required, Printer_Type, Corresponding_A4_SKU,  +
 Template_Family, Page_Size, Orientation,
Number_of_Lbls_Cards_per_Sheet, Label_Height, Label_Width,  +
 Corner_Radius, Number_Sections_Across,
Number_Sections_Down, Top_Margin, Bottom_Margin, Left_Margin,  +
 Right_Margin, Horiz_Pitch, Vertical_Pitch,
Sheet_Width, Sheet_Depth, Unique_Product_Code) +
 VALUES(:Original, :Product_Code, :Cross_Reference,
:Sequence, :Unique_Product_ID, :Trademark, :Patent_Pending,  +
 :Avery_Product_Category, :Product_Description,
:Priority_SKU, :Product_Type, :Coated_Stock, :Photo_Quality,  +
 :Full_Bleed, :Mirror_Image_Required, :Printer_Type,
:Corresponding_A4_SKU, :Template_Family, :Page_Size,  +
 :Orientation, :Number_of_Lbls_Cards_per_Sheet,
:Label_Height, :Label_Width, :Corner_Radius,  +
 :Number_Sections_Across, :Number_Sections_Down,
:Top_Margin, :Bottom_Margin, :Left_Margin, :Right_Margin,  +
 :Horiz_Pitch, :Vertical_Pitch, :Sheet_Width,
:Sheet_Depth :Unique_Product_Code);

 insertStatement = new SQLStatement();
 insertStatement.sqlConnection = conn;
 insertStatement.addEventListener(SQLEvent.RESULT,
insertResult);
 insertStatement.addEventListener(SQLErrorEvent.ERROR,
errorHandler);
 insertStatement.text = sqlText;

 insertStatement.parameters[:Original] =
node.attributes.Original;
 insertStatement.parameters[:Product_Code] =
node.attributes.Product_Code;
 insertStatement.parameters[:Cross_Reference] =
node.attributes.Cross_Reference;
 insertStatement.parameters[:Sequence] =
node.attributes.Sequence;
 insertStatement.parameters[:Unique_Product_ID] =
node.attributes.Unique_Product_ID;
 insertStatement.parameters[:Trademark] =
node.attributes.Trademark;
 insertStatement.parameters[:Patent_Pending] =
node.attributes.Patent_Pending;
 insertStatement.parameters[:Avery_Product_Category] =
node.attributes.Avery_Product_Category;
 insertStatement.parameters[:Product_Description] =
node.attributes.Product_Description;
 insertStatement.parameters[:Priority_SKU] =
node.attributes.Priority_SKU;
 insertStatement.parameters[:Product_Type] =
node.attributes.Product_Type;
 insertStatement.parameters[:Coated_Stock] =
node.attributes.Coated_Stock;
 insertStatement.parameters[:Photo_Quality] =
node.attributes.PhotoQuality;
 insertStatement.parameters[:Full_Bleed] =
node.attributes.Full_Bleed;
 insertStatement.parameters[:Mirror_Image_Required] =
node.attributes.Mirror_Image_Required;
 insertStatement.parameters[:Printer_Type] =
node.attributes.Printer_Type;
 insertStatement.parameters[:Corresponding_A4_SKU] =
node.attributes.Corresponding_A4_SKU;
 insertStatement.parameters[:Template_Family] =
node.attributes.Template_Family;
 insertStatement.parameters[:Page_Size] =
node.attributes.Page_Size;
 insertStatement.parameters[:Orientation] =
node.attributes.Orientation;

insertStatement.parameters[:Number_of_Lbls_Cards_per_Sheet] =
node.attributes.Number_of_Lbls_Cards_per_Sheet;
 insertStatement.parameters[:Label_Height] =
node.attributes.Label_Height;
 insertStatement.parameters[:Label_Width] =
node.attributes.Label_Width;
 insertStatement.parameters[:Corner_Radius] =
node.attributes.Corner_Radius;
 insertStatement.parameters[:Number_Sections_Across] =
node.attributes.Number_Sections_Across;
 insertStatement.parameters[:Number_Sections_Down] =
node.attributes.Number_Sections_Down;
 insertStatement.parameters[:Top_Margin] =
node.attributes.Top_Margin;
 insertStatement.parameters[:Bottom_Margin] =
node.attributes.Bottom_Margin;
 insertStatement.parameters[:Left_Margin] =
node.attributes.Left_Margin;
 insertStatement.parameters[:Right_Margin] =
node.attributes.Right_Margin;
 insertStatement.parameters[:Horiz_Pitch] =
node.attributes.Horiz_Pitch;
 

[flexcoders] Re: Need help finding and fixing SQL Error in AIR App

2008-04-29 Thread bredwards358
--- In flexcoders@yahoogroups.com, valdhor [EMAIL PROTECTED] wrote:

 I don't know whether this is your problem but your Orientation field
 has no type in your create table function.
 
 
 --- In flexcoders@yahoogroups.com, bredwards358 bredwards358@
 wrote:
 Snip


Sadly, no, but thanks anyway for pointing that out. I think the
problem has something to do with the way the XML document is
structured. The example I drew this from used an example xml file
structured like this:

?xml version =1.0 encoding=utf-8?
months
month sortOrder=1 English=January Spanish=Enero/
...
...
month sortOrder=12 English=December Spanish=Diciembre/
/months

So perhaps it may be trying to read my xml document as if it were
structured like this and throwing an error for each and every entry?



[flexcoders] Re: Programming an AIR App to accept input from a PALM device...

2008-04-25 Thread bredwards358
Well, I'm not sure what is the core part of the conduit software at
the moment since the main module of it is rather large, but after doing
some more looking in on the subject, I learned that a Palm conduit is a
DLL application, usually coded in C/C++ or VB in this case and installed
on the PC that implements the supported function calls to sync with the
Device usually in response to the presence of a database with the right
identification. As per this article
http://www.codeproject.com/KB/mobile/PalmOS_II.aspx

So, the more I think about it, the more I believe that this is not as
unfeasable as previously thought. Though I could be wrong. From what I
can tell from the VB code, it looks like it is simply comparing data and
checking for changes among other things I can only vaguely identify
right now.

--- In flexcoders@yahoogroups.com, Kevin Aebig [EMAIL PROTECTED] wrote:

 Though it's unorthodox, perhaps you could post the core aspects of the
VB
 code and some of us can tell you if it's even feasible and if so, than
how
 to move forward.



 !k



   _

 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
 Behalf Of bredwards358
 Sent: Wednesday, April 23, 2008 6:21 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Programming an AIR App to accept input from a
PALM
 device...



 As per a suggestion from another member of the forum, I have decided
 to repost my question with a more descriptive title. Right now I am
 currently in the midst of designing an Adobe AIR application which is
 basically a new and improved version of legacy software coded in VB6
 (I'm using Flex 3). At the moment I'm purely working on the client
 side of things and one issue I'll be having to deal with is this:

 The old VB6 application was able to accept input from synchronized
 PALM devices as well as others, but I want to focus on PALM first.
 Now, I've never developed this kind of software before, and I'm even
 quite new to Adobe Flex and AIR, having only been using them for the
 past few weeks.

 That said, I'm having trouble figuring out where to get started, I'm
 aware that I need some sort of conduit software, but I don't know
 whether I need to code that myself or simply download it. I'm also not
 sure where to begin going about setting things up so that the software
 I'm working on can listen for when a client scans a barcode and having
 the results show up in the application on the desktop.

 I'm searching google as well but my search-fu is rather weak so
 that'll take a while so I have decided to post here in the meantime.
 This is by no means time-critical as this is just the beginning of the
 project.

 Thanks in advance.




[flexcoders] Programming an AIR App to accept input from a PALM device...

2008-04-23 Thread bredwards358
As per a suggestion from another member of the forum, I have decided
to repost my question with a more descriptive title. Right now I am
currently in the midst of designing an Adobe AIR application which is
basically a new and improved version of legacy software coded in VB6
(I'm using Flex 3). At the moment I'm purely working on the client
side of things and one issue I'll be having to deal with is this:

The old VB6 application was able to accept input from synchronized
PALM devices as well as others, but I want to focus on PALM first.
Now, I've never developed this kind of software before, and I'm even
quite new to Adobe Flex and AIR, having only been using them for the
past few weeks. 

That said, I'm having trouble figuring out where to get started, I'm
aware that I need some sort of conduit software, but I don't know
whether I need to code that myself or simply download it. I'm also not
sure where to begin going about setting things up so that the software
I'm working on can listen for when a client scans a barcode and having
the results show up in the application on the desktop.

I'm searching google as well but my search-fu is rather weak so
that'll take a while so I have decided to post here in the meantime.
This is by no means time-critical as this is just the beginning of the
project.

Thanks in advance.



[flexcoders] Hello, and a question...

2008-04-21 Thread bredwards358
Hi, I'm new to this group so I would like to get my introductions out
of the way before I ask my question. I've recently begun a project at
work which involves an Adobe AIR application coded in Flex 3. It is
essentially a totally new version of legacy software which was coded
in VB 6. I am quickly getting to the point where I need to begin
coding the logic for the program which will be mostly done in
Actionscript.

The legacy software included functionality for sending and receiving
information from PALM PDA's. I've never dealt with these devices
before and while I can look at the VB 6 modules to see how it was done
there, I really have no idea where to begin on how to figure out how
that works or where to begin on implementing similar functionality in
my own project. 

What I'm asking essentially is a point in the right direction of
something that can help me write in functionality for PALM handhelds
for the application. I appreciate and thank you for your assistance in
advance.

-Brian



[flexcoders] Re: Hello, and a question...

2008-04-21 Thread bredwards358
Thanks and I'll be sure to be mindful of that in the future. First off
I am not wondering if I can get an AIR app to run on a PALM device, as
I'm pretty sure that can't happen. I am wondering about how to accept
input from a PALM device. Some parts of the app I'm building are
supposed to accept input from a PALM device that has, for example
scanned a barcode and can send that input from the scanner to the AIR
app on the client computer. I do not have any idea on how the
client/server relationship works since I have not gotten to that part
yet. The functionality I am trying to implement is on the client side
at the moment so server-side functionality can be ignored for now. 

I guess the core of my question is how is a PALM conduit coded for
desktop applications.

I'll try to be as descriptive as I can but be warned, I have only been
coding in Flex for the past two weeks since I have picked it up after
my boss and I fell in love with the idea of an AIR application that is
as much web as desktop. If you are still confused, don't hesitate to
tell me, the more clarity the better.

--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote:

 Welcome!
 
  
 
 Since it is your first post here, we'll forgive you ;), but hereafter,
 please make your subject descriptive of your question, and indicate if
 it is about AIR (if you think that may be significant).  The traffic on
 this list prevents us from reading all posts, so many of us use the
 subject to decide whethere we can be of any use.
 
  
 
 Now, your question is pretty general.  I am not sure I understand the
 architecture you are thinking about.  Are you expecting the AIR app to
 run on the PDAs?  That might (I do not do AIR yet) be an issue in
 itself.  Can you describe the architecture of the legacy app?  What
 happens on the server (not Flex), what on the client(Flex) and how the
 communication between client ans server is handled?
 
  
 
 Tracy
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of bredwards358
 Sent: Monday, April 21, 2008 10:41 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Hello, and a question...
 
  
 
 Hi, I'm new to this group so I would like to get my introductions out
 of the way before I ask my question. I've recently begun a project at
 work which involves an Adobe AIR application coded in Flex 3. It is
 essentially a totally new version of legacy software which was coded
 in VB 6. I am quickly getting to the point where I need to begin
 coding the logic for the program which will be mostly done in
 Actionscript.
 
 The legacy software included functionality for sending and receiving
 information from PALM PDA's. I've never dealt with these devices
 before and while I can look at the VB 6 modules to see how it was done
 there, I really have no idea where to begin on how to figure out how
 that works or where to begin on implementing similar functionality in
 my own project. 
 
 What I'm asking essentially is a point in the right direction of
 something that can help me write in functionality for PALM handhelds
 for the application. I appreciate and thank you for your assistance in
 advance.
 
 -Brian