Normal Topic Max or not max ? (Read 782 times)
ychaouche
Member
*
Offline



Posts: 6
Joined: Nov 1st, 2017
Max or not max ?
Nov 19th, 2017 at 10:50pm
Print Post Print Post  
Hello lantica community,

In this example, the max key returned by sesame is 1336, although I can find a record with key = 1337. How come ? (search on !key=Max 1 should have returned 1336 instead of 1337, no ?)

Code
Select All
In [13]: rs = sesame.SesameSearch("Customers.db","Customers",0,2,"!Key=Max 1","","")

In [14]: sesame.SesameTotal(rs)
Out[14]: 1

In [15]: sesame.SesameGetValue(rs,"Key")
Out[15]: '1336.00000000'

In [16]: rs = sesame.SesameSearch("Customers.db","Customers",0,2,"Key=1337","","")

In [17]: rs
Out[17]: 2

In [18]: sesame.SesameTotal(rs)
Out[18]: 1

In [19]: sesame.SesameGetValue(rs,"Key")
Out[19]: '1337.00000000'

In [20]: sesame.SesameGetValue(rs,"First")
Out[20]: 'Clooney'

In [21]: sesame.SesameGetValue(rs,"Last")
Out[21]: 'George'

In [22]: sesame.SesameGetValue(1,"Key")
Out[22]: '1336.00000000'

In [23]: sesame.SesameGetValue(1,"First")
Out[23]: 'Belbachir'

In [25]: sesame.SesameGetValue(1,"Last")
Out[25]: 'Lamine' 

  
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: Max or not max ?
Reply #1 - Nov 20th, 2017 at 5:45pm
Print Post Print Post  
Was the 1337 record added from the API?
What are the contents of the sesame.ini file that the server computer is using?

-Ray
  

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



Posts: 6
Joined: Nov 1st, 2017
Re: Max or not max ?
Reply #2 - Nov 21st, 2017 at 7:51am
Print Post Print Post  
Hello Ray,

Yes, both 1337 and 1336 were added from the API.

Here's my ini file

Code
Select All
// SESAME.INI FILE. ONLY LINES THAT START ON THE LEFT MARGIN, WITHOUT //, ARE ACTIVE.
//  SO TO MAKE A LINE ACTIVE DELETE BOTH THE // AND THE SPACE, LIKE THE LINES BELOW ..

QUICK START: OFF		// DISPLAYS QUICK START MENU ON STARTING SESAME
BLINK: OFF			// CURSOR BLINK
GLOBAL AUTOCOMPLETE: OFF	// PROMPT WITH EXISTING VALUES AS YOU TYPE IN A FIELD
HIGHLIGHT ON ENTER: OFF		// IF SET TO "ON" SELECTS FIELD VALUES ON ENTRY

// MENU STYLE OPTIONS
MENU STYLE: BUTTONS		// "BUTTONS" or "TREE"
// MENU STYLE: TREE 		// USE THIS TO REVERT TO PREVIOUS MENU TREE STYLE


// DICTIONARY OPTIONS
INTERACTIVE SPELL CHECKING: OFF	  // CHANGE TO "ON" FOR SPELL CHECKING AS YOU TYPE
// DICTIONARY PATH: C:\Sesame2\Dictionary.txt	// CAN BE USED TO SPECIFY ALTERNATIVE DICT. FILE


// THESE CAN BE USED TO FIX SIZE & POSITION OF THE SESAME WINDOW ..
// THE MEASUREMENTS ARE IN PIXELS, AS IS YOUR SCREEN RESOLUTION, eg 1024 x 768
// WIDTH: 900
// HEIGHT: 610
// X: 105	// MEASURED FROM TOP LEFT OF THE SCREEN
// Y: 80	// MEASURED FROM TOP LEFT OF THE SCREEN


// THESE CAN BE USED TO SET THE SESAME COLORS ..
// BACKGROUND COLOR: 236 233 216	      // MAIN SESAME BACKGROUND
// SECONDARY BACKGROUND COLOR: 255 255 255    // BACKGROUND OF MENU TREE ETC

// MENU FONT:  Tahoma
// MENU FONT SIZE: 11

// SETS THE WIDTH OF THE TABLE ROW HEADER, including subforms.
TABLE ROW HEADER WIDTH: 40

// Makes scrollbars for forms, table view more distinctive. Cannot have a comment on same line.
SLIDER BOX STYLE: UP

// Affects vertical scrollbar for the menu tree. Does not affect form scrollbars
DEFAULT SCROLLBAR WIDTH: 16

// SETTINGS USED IN SESAME DESIGNER ...

SNAP TO GRID: OFF
GRID WIDTH: 8
GRID HEIGHT: 8

PROGRAM EDITOR FONT SIZE: 12

// THIS ENABLES PAGE BREAKS IN REPORTS IN HTML PREVIEW MODE INSTEAD OF A VISUAL REPRESENTATION OF THE PAGE BREAK
REPORT PAGE BREAK ALWAYS: ON
 

  
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: Max or not max ?
Reply #3 - Nov 21st, 2017 at 6:50pm
Print Post Print Post  
What version of Sesame are you running?

I just tried this the following with 2.6.4, using your ini file and without any INI file, and it works perfectly.
Start a Sesame Server
Create a record using the PHP API with a ID of 1336(highest number in the database on my side)
Run another script that uses the PHP API to write out the record found with MAX 1. It writes out 1336.

Any language should have the same result, I just prefer PHP for a quick and dirty script like these.

-Ray
  

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