Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Warning level and Mass Updates (Read 9853 times)
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #15 - Apr 8th, 2019 at 11:11pm
Print Post Print Post  
Hi Ray,

The lines below are suppose to create another record in the CUSTOMERANDACCOUNTS form of my current database.  It is still not working.  What am I missing?


** I added a WriteLn(RSHandle) and the result was -1 **

The sample checks that RSHandle must be greater than -1.

IF vTERMS = "Layaway" AND @ADD AND GUIDE = "" THEN {            #include "sbasic_include.sbas"
                                               vRSHandle = @XResultSetNew(@FN, "CUSTOMERANDACCOUNTS")
                                               XResultSetCreateNewRecord(vRSHandle)
                                               XResultSetValue(vRSHandle,"FNAME0",FNAME)
                                               XResultSetValue(vRSHandle, "LNAME0", LNAME)
                                                 XResultSetValue(vRSHandle, "STREET0", STREET)
                                               XResultSetValue(vRSHandle, "CITY1", CITY)
                                               XResultSetValue(vRSHandle, "POSTAL CODE0", POSTAL CODE)
                                               XResultSetValue(vRSHandle, "DATE0", DATE10)
                                               XResultSetValue(vRSHandle, "CATEGORY", TERMS0)
                                               XResultSetValue(vRSHandle, "BALANCE", ANEWBAL)
                                               XResultSetValue(vRSHandle, "PHONE10", PHONE1)      
                                               XResultSetClose(vRSHandle)
                                               GUIDE = @XLU(@FN,PHONE1,"CUSTOMERANDACCOUNTS!PHONE10","BALANCE")
                                                                 FormCommit("")}
« Last Edit: Apr 9th, 2019 at 3:13am by cbislander »  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Warning level and Mass Updates
Reply #16 - Apr 9th, 2019 at 1:29pm
Print Post Print Post  
If you run the following code, what output do you get?

Code
Select All
IF vTERMS = "Layaway" AND @ADD AND GUIDE = "" THEN
{
	Writeln("Inside the If Statement")
	vRSHandle = @XResultSetNew(@FN, "CUSTOMERANDACCOUNTS")
	if(vRSHandle > -1)
	{
		Writeln("Got a ResultSet")
		XResultSetCreateNewRecord(vRSHandle)
		XResultSetValue(vRSHandle, "FNAME0",FNAME)
		XResultSetValue(vRSHandle, "LNAME0", LNAME)
		XResultSetValue(vRSHandle, "STREET0", STREET)
		XResultSetValue(vRSHandle, "CITY1", CITY)
		XResultSetValue(vRSHandle, "POSTAL CODE0", POSTAL CODE)
		XResultSetValue(vRSHandle, "DATE0", DATE10)
		XResultSetValue(vRSHandle, "CATEGORY", TERMS0)
		XResultSetValue(vRSHandle, "BALANCE", ANEWBAL)
		XResultSetValue(vRSHandle, "PHONE10", PHONE1)
		XResultSetClose(vRSHandle)
		GUIDE = @XLU(@FN, PHONE1, "CUSTOMERANDACCOUNTS!PHONE10", "BALANCE")
	}
	Else
	{
		Writeln("Failed to get a ResultSet")
	}
	FormCommit("")
} 



-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #17 - Apr 9th, 2019 at 2:42pm
Print Post Print Post  
Hi Ray,

Just tried it out.

This is what I get.

Inside the If Statement
Failed to get a ResultSet
Inside the If Statement
Failed to get a ResultSet


Cavel
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Warning level and Mass Updates
Reply #18 - Apr 9th, 2019 at 2:50pm
Print Post Print Post  
Is 'CUSTOMERANDACCOUNTS' the name of the database and is it inside the current application? The XResultSet commands work with Database and Field names, not Form and Element names like XLookup.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #19 - Apr 9th, 2019 at 3:33pm
Print Post Print Post  
The name of the form.

I thought that's what I had to use since I used @FN before it.


I ran the Document Application and it lists Database 1 - Customer
                                                              Database 7 - CUSTOMERANDACCOUNTS

Which is the one I want to create the new record and fill in with information from the Customer database.

I tried a different approach to see what would happen.
Instead of creating a record in the same application, I redid it to post to a new application so I didn't use @FN.

I made a new database  "DATA\LAY.DB"
The only form was called "ACCOUNTS"
The Fields were the basic ones.


IF vTERMS = "Layaway" AND @ADD AND GUIDE = "" THEN
{
     Writeln("Inside the If Statement")
     vRSHandle = @XResultSetNew("DATA\LAY.DB", "ACCOUNTS")
     if(vRSHandle > -1)
     {
           Writeln("Got a ResultSet")
           XResultSetCreateNewRecord(vRSHandle)
           XResultSetValue(vRSHandle, "FNAME",FNAME)
           XResultSetValue(vRSHandle, "LNAME", LNAME)
           XResultSetValue(vRSHandle, "STREET", STREET)
           XResultSetValue(vRSHandle, "CITY", CITY)
           XResultSetValue(vRSHandle, "PCODE", POSTAL CODE)
           XResultSetValue(vRSHandle, "CATEGORY", TERMS0)
           XResultSetValue(vRSHandle, "BALANCE", ANEWBAL)
           XResultSetValue(vRSHandle, "PHONE", PHONE1)
           XResultSetClose(vRSHandle)
           GUIDE = @XLU("DATA\LAY.DB", PHONE1, "ACCOUNTS!PHONE", "BALANCE")
     }

The account was created, but for some reason created 4 times.
Inside the If Statement
Got a ResultSet
Inside the If Statement
Got a ResultSet
Inside the If Statement
Got a ResultSet
Inside the If Statement
Got a ResultSet


I tried to revert back to the other database, but still no luck.

    
« Last Edit: Apr 10th, 2019 at 3:39am by cbislander »  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Warning level and Mass Updates
Reply #20 - Apr 10th, 2019 at 4:23pm
Print Post Print Post  
Is CUSTOMERANDACCOUNTS a sub database? If so you'll need to use the full database name which can be seen in the Property Viewer.

Open the CUSTOMERANDACCOUNTS form in Sesame Designer
Scroll down to the Property Viewer
In the "View Settings for:" select Database
You'll see the full Database Name

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #21 - Apr 10th, 2019 at 8:27pm
Print Post Print Post  
Hi Ray,

View Settings For: Database


Database Name CUSTOMERANDACCOUNTS


The database with the programming (the invoice)  is a sub database of this one.

Database Name CUSTOMERANDACCOUNTS!CUSTOMER



  
Back to top
 
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #22 - Apr 12th, 2019 at 2:17pm
Print Post Print Post  
Hi Ray,

I seem to be making headway on the posting issues, but the receiving database tends to lock up.

Instead of using the @FN approach, I made an external database LAY.db and was able to copy the information to it the same way I do it for Q&A.  I also wanted to set it up so it not only created the account/layaway but would also have a form with running activity for the account.

The first time it created the account.
I then copy the commands to create the subrecord, but then the invoice only created the subrecord and not the account.
I then moved the subrecord commands to the next form field to see if that would make a difference; it work, but 4 copies were generated of the subrecord.

Anyway, thanks for all your help; I seem to be getting closer to making it work.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print