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



Posts: 103
Joined: Mar 22nd, 2018
Warning level and Mass Updates
Feb 21st, 2019 at 4:38am
Print Post Print Post  
I have read that changing Warning level to None should stop the warning prompt before the mass update is done.  This would make in possible to have a Subroutine Mass Update.

The instructions used an example with a Delete subroutine.

#include "sbasic_include.sbas"
WarningLevel(WARNING_LEVEL_NONE)
DeleteRecord()
WarningLevel(WARNING_LEVEL_SOME

I have tried to do this on a invoice that Mass Updates the subform lines after the main form is completed.  It still prompts the mass update warning but not the delete warning.

It seems each work around I come up with hits a glitch.

The main form is in free form view while the subform is in Table View.

I can use a save mass update manually, but it will not work automatically unless I use a macro which is not recommended.

What am I missing?
  
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 #1 - Feb 21st, 2019 at 4:40pm
Print Post Print Post  
The Mass Update popup can't be suppressed with the WarningLevel() command, as the user needs to choose which way to perform the Mass Update. You can run a Mass Update without this prompt by using RunMassUpdateSpec()

-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 #2 - Feb 23rd, 2019 at 2:31am
Print Post Print Post  
Hi Ray,

I tried using a the RunMassUpdateSpec() in both the main form and the sub form.

Main Form

IF @LEFT(TCD,2) = "CT" AND @ADD AND MESSAGE = "" THEN {vWarn = @LoadMassUpdateSpec("CT6")
                                         FormCommit("")
                                         @SAVE
                                         RunMassUpdateSpec()}

The first field in each subform record is highlight but the update does not happen.

  When I do it manually, it does after the warning how many (subform) records will be done.
  
Back to top
 
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #3 - Feb 23rd, 2019 at 4:13pm
Print Post Print Post  
Hi Ray,

It is sort of working.  I ran the mass update from the main form to adjust items in the subform.

var vWarn as int
vWarn = @LoadMassUpdateSpec("CT6")
IF @LEFT(TCD,2) = "CT" AND @ADD AND MESSAGE = "" THEN {FormCommit("")
                                         @SAVE
                                         RunMassUpdateSpec()}

The first field in each sub form record is highlighted in black and will only do the desired update if I click on that field in
each record.

I have included a picture that shows what happens after I click on the first record after the Mass Update runs

Is there something else I have to do?
  

MASS-UPDATE.jpg ( 183 KB | 120 Downloads )
MASS-UPDATE.jpg
Back to top
 
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #4 - Feb 24th, 2019 at 9:11pm
Print Post Print Post  
I had the same formulas in the first field of my subform  as what was in the Mass Update.  I had removed them thinking that the Mass Update was working, except I had to click on each individual record.  So it was actually, the formulas that were working and not the Mass Update.

When I am going through the invoice, it looks like Mass Update is trying to do something, but the fields are still blank.


I have included a copy of the Mass Update for the Sub Form.
  

MASSUPDATE-CT6.txt ( 0 KB | 101 Downloads )
Back to top
 
IP Logged
 
cbislander
Full Member
***
Offline



Posts: 103
Joined: Mar 22nd, 2018
Re: Warning level and Mass Updates
Reply #5 - Feb 27th, 2019 at 12:24am
Print Post Print Post  
I decided to create a new generic database with minimal programming to test the recommended command setup.

When I am using the Mass Update on the main form,  it seems to work okay.  I then created a subform and made a Mass Update spec for that one.


The results were the same as my original database.  All the records in the subform (in table mode) have a field in each record shaded black, but the fields are still blank.


When I do the Mass Update manually, it works fine.
  
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 #6 - Feb 27th, 2019 at 2:47pm
Print Post Print Post  
For what it looks like you are wanting to do, you don't want to be using a mass update. You're gonna want to write a loop from the parent form that manipulates the data for each subform record. Something like

Code
Select All
Var vLoop as Int
Var vCnt as Int
Var vSub as String
Var vPrice as Money

vSub = "Gems"
vLoop = 1
VCnt = @FormResultSetTotal(vSub)
While VLoop <= vCnt
{
	FormResultSetCurrentPosition(vSub, vLoop)
	//Grab Current Price from subform
	vPrice = @FormFieldValue(vSub, "Price", 0)
	//Incease by 10%
	vPrice = vPrice * 1.1
	//Write Current price back to subform
	FormFieldValue(vSub, "Price", 0, vPrice)
	FormCommit(vSub)
	vLoop = vLoop + 1
}
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 #7 - Feb 27th, 2019 at 7:47pm
Print Post Print Post  
Thanks, I will give it a shot and let you know.
  
Back to top
 
IP Logged
 
cbislander
Full Member
***
Offline



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

This solved my problem and with a little tweeking with the money rounding was able to get the same results as my Q&A program.

My next problems concerns copying from one database to another.  In Q&A, if the customer was making a new charged purchase, a Layaway, a new account would be created in the Lay.dtf during the invoice print process.  I have tried using the XResultset commands, but it has not worked in Sesame.  I have made an external database for the accounts and an internal form within the same database;  neither seemed to work.

I also use this setup to add items to our inventory when I am doing stock transfers.

The way I got it to work is to have Blank records that will be changed to new accounts by using the XPost command.  These records actually contain the word "Blank" in one of their fields.


The commands I use is below:

]IF vTERMS = "Layaway" AND @ADD AND GUIDE = "" THEN {xpost(@FN,vBlank,"CUSTOMERANDACCOUNTS!PHONE10",vInvoice,"PHONE10","")            
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",FNAME,"FNAME0","")
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",LNAME,"LNAME0","")      
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",STREET,"STREET0","")      
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",CITY,"CITY1","")
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",POSTAL CODE,"POSTAL CODE0","")
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",DATE10,"DATE0","")
                                xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",TERMS0,"CATEGORY","")
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",ANEWBAL,"BALANCE","")
                       xpost(@FN,vINVOICE,"CUSTOMERANDACCOUNTS!PHONE10",PHONE1,"PHONE10","")
                       GUIDE = @XLU(@FN,INVOICE,"CUSTOMERANDACCOUNTS!PHONE10","BALANCE")
                                                                 FormCommit("")}

I included an copy of what the customerandaccounts form looks like.


  

customer.pdf ( 228 KB | 101 Downloads )
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 #9 - Apr 8th, 2019 at 1:31pm
Print Post Print Post  
The XResultSet family of commands are made for doing this so it is either a syntax issue(Bad path, Wrong database or fields names) or a security issue if the applications have security on them.

-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 #10 - Apr 8th, 2019 at 3:28pm
Print Post Print Post  
Hi Ray,

Is this the right command to use?
It isn't in the Programming Guide, but it was on the site.

@XResultSetNew(filename, db)
Type: External Database Application Management
Parameters: filename as string, db as string
Returns: int
This command is the best way to obtain a new, empty result set for the purpose of adding new
records.
@XResultSetNew takes two arguments:
filename - the filename of the application to open. If the records you want are in the current
application, you can use @FN for the filename.
db - the name of the database in that application.
#include "sbasic_include.sbas"
var vRSHandle as int
vRSHandle = @XResultSetNew("Customers.db", "Customers")
if(vRSHandle > -1)
{
XResultSetCreateNewRecord(vRSHandle)
XResultSetValue(vRSHandle, "First", "William")
XResultSetValue(vRSHandle, "Last", "Halpern")
XResultSetClose(vRSHandle)

Cavel Rahey
  
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 #11 - Apr 8th, 2019 at 3:36pm
Print Post Print Post  
Yes. That is an example of creating a new ResultSet(Think like opening a form in Add Data) and then creating a new Record in it and then filling in some fields on that record.

-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 #12 - Apr 8th, 2019 at 5:52pm
Print Post Print Post  
Hi Ray,

I have entering invoices in my Sesame database while they are being done in Q & A.  The Sesame database will not open, even when I unlock it.

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 #13 - Apr 8th, 2019 at 6:54pm
Print Post Print Post  
When you unlock the application, What does the status field say?
What error message are you getting when you try to open the DB file?

-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 #14 - Apr 8th, 2019 at 7:43pm
Print Post Print Post  
Here's what shows up in my log when I try to start it up.

server_error            failure while loading application
server_error            Failed to read a record
server_error            Cannot memory seek
server_note             Logging start of standalone...
server_note             Shutting down server.

There wasn't much in the database so I just copied it over.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print