Normal Topic Programming Problem (Read 668 times)
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Programming Problem
Apr 23rd, 2004 at 7:17pm
Print Post Print Post  
I am working on the Invoice example from the March and April InsideSesame.  I have an error that I can't figure out.  I will list the error and then the code.


Error while parsing module "Find (0)":
Symbol expected [}], symbol found [Identifier].
Line 86, position 9: [Identifier: Invoicedate]
Invoicedate = @date
                                                      ^



** PROGRAMMING SECTION: [Find] [On Element Entry] **
var vAllCustomers as String
var vAllCustNos as String
var vCompany as String
var vCompanies as String
var vCnt as Int
If Cust# <> "" Then
{
If @XLookup(@Fn, Cust#, "Customers!Customer #",
"Customer #") <> "" Then
{
vCompany = @XLookup(@Fn, Cust#,
"Customers!Customer #", "Company")
vCompanies = vCompanies + vCompany + ";"
vCnt += 1
}
Else
{
vAllCustomers = @XListValues(@Fn,
"Customers!Company")
While @Len(vAllCustomers) > 0
{
vCompany = Split(vAllCustomers, ";")
If @Left(vCompany, @Len(Cust#)) = Cust# Then
{
vCompanies = vCompanies + vCompany + ";"
vCnt += 1
}
}
}
If vCnt > 0 Then
{
vCompanies = @Repllas(vCompanies, ";", "")
Company = @PopUpMenu(vCompanies,"SELECT
CUSTOMER" + @NewLine() + "FOR THIS INVOICE")
If Company <> "" Then
{
Cust# = @XLookup(@Fn, Company, "Customers!
Company", "Customer #")
Name = @XLookup(@Fn, Company, "Customers!
Company", "Name")
Address = @XLookup(@Fn, Company, "Customers!
Company", "Address")
City = @XLookup(@Fn, Company, "Customers!
Company", "City")
State = @XLookup(@Fn, Company, "Customers!
Company", "State")
Zip = @XLookup(@Fn, Company, "Customers!
Company", "Zip")
}
}
Else
{
@Msgbox("No companies found that begin with &#8216;"
+ Cust# + "&#8216;","","")
}
}
If Cust# = "" Then
{
vAllCustomers = @XListValues(@Fn, "Customers!
Company")
Company = @PopupMenu(vAllCustomers, "SELECT
CUSTOMER" + @NewLine() + "FOR THIS INVOICE")
If Company <> "" Then
{
Cust# = @XLookup(@Fn, Company, "Customers!
Company", "Customer #")
Name = @XLookup(@Fn, Company, "Customers!
Company", "Name")
Address = @XLookup(@Fn, Company, "Customers!
Company", "Address")
City = @XLookup(@Fn, Company, "Customers!
Company", "City")
State = @XLookup(@Fn, Company, "Customers!
Company", "State")
Zip = @XLookup(@Fn, Company, "Customers!
Company", "Zip")
}
}

If Company <> "" Then
If Invoice# = "" Then

{

     Invoice# = @Number
     Invoicedate = @Date

}



What am I missing?
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Programming Problem
Reply #1 - Apr 23rd, 2004 at 8:19pm
Print Post Print Post  
I am not sure why you get that error. I have lots to learn so one of the more knowledgeable people out here will need to answer the why question.

I did match my code that works with yours and except for an element name and an extra variable they seemed the same so I took your code and  put it into my working example and found that I had to replace all the cust# with cu# and it works fine. I get no errors.

Try replacing your code with this. If your element is cust# instead of Cu# change them back as needed.

Keep us posted!

var vAllCustomers as String
var vAllCustNos as String
var vCompany as String
var vCompanies as String
var vCnt as Int
If Cu# <> "" Then
{
If @XLookup(@Fn, Cu#, "Customers!Customer #",
"Customer #") <> "" Then
{
vCompany = @XLookup(@Fn, Cu#,
"Customers!Customer #", "Company")
vCompanies = vCompanies + vCompany + ";"
vCnt += 1
}
Else
{
vAllCustomers = @XListValues(@Fn,
"Customers!Company")
While @Len(vAllCustomers) > 0
{
vCompany = Split(vAllCustomers, ";")
If @Left(vCompany, @Len(Cu#)) = Cu# Then
{
vCompanies = vCompanies + vCompany + ";"
vCnt += 1
}
}
}
If vCnt > 0 Then
{
vCompanies = @Repllas(vCompanies, ";", "")
Company = @PopUpMenu(vCompanies,"SELECT
CUSTOMER" + @NewLine() + "FOR THIS INVOICE")
If Company <> "" Then
{
Cu# = @XLookup(@Fn, Company, "Customers!
Company", "Customer #")
Name = @XLookup(@Fn, Company, "Customers!
Company", "Name")
Address = @XLookup(@Fn, Company, "Customers!
Company", "Address")
City = @XLookup(@Fn, Company, "Customers!
Company", "City")
State = @XLookup(@Fn, Company, "Customers!
Company", "State")
Zip = @XLookup(@Fn, Company, "Customers!
Company", "Zip")
}
}
Else
{
@Msgbox("No companies found that begin with &#8216;"
+ Cu# + "&#8216;","","")
}
}
If Cu# = "" Then
{
vAllCustomers = @XListValues(@Fn, "Customers!
Company")
Company = @PopupMenu(vAllCustomers, "SELECT
CUSTOMER" + @NewLine() + "FOR THIS INVOICE")
If Company <> "" Then
{
Cu# = @XLookup(@Fn, Company, "Customers!
Company", "Customer #")
Name = @XLookup(@Fn, Company, "Customers!
Company", "Name")
Address = @XLookup(@Fn, Company, "Customers!
Company", "Address")
City = @XLookup(@Fn, Company, "Customers!
Company", "City")
State = @XLookup(@Fn, Company, "Customers!
Company", "State")
Zip = @XLookup(@Fn, Company, "Customers!
Company", "Zip")
}
}

If Company <> "" Then
If Invoice# = "" Then

{

Invoice# = @Number
Invoicedate = @Date

}
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Programming Problem
Reply #2 - Apr 23rd, 2004 at 8:24pm
Print Post Print Post  
CapitalG,

Make sure that Invoicedate actually is the name of your Layout Element. This type of error is usually caused by referencing something that does not actually exist.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
CapitalG
Full Member
Members
***
Offline



Posts: 143
Location: Phoenix, Arizona
Joined: Mar 4th, 2003
Re: Programming Problem
Reply #3 - Apr 23rd, 2004 at 8:53pm
Print Post Print Post  
Thanks! 

I thought I checked and double checked my names - but that was the problem.

Thank you.
Grin

  
Back to top
 
IP Logged