[Pas2js] Dataset improved

warleyalex warleyalex at yahoo.com.br
Sun Dec 30 21:55:38 CET 2018


In my 5-minute-experiment, using TMS Web Core with Lazarus component,
"locate" function does not work for me :(

I dropped into Lazarus designer, basically 8 visual widgets:
  WebDataSource1: TWebDataSource;
  WebClientConnection1: TWebClientConnection;
  WebClientDataSet1: TWebClientDataSet;
  WebClientDataSet1_Length__cm_: TLongintField;
  WebDBLabel1: TWebDBLabel;
  WebEdit1: TWebEdit;
  WebButton1: TWebButton;
  WebButton2: TWebButton;

i) When I hit button/WebButton1 (Connect), the label/WebDBLabel1 component
displays "50" as expected! 
ii) When I click at WebButton2, it shows False (the edit/WebEdit1 is set to
50)

procedure TWebForm1.WebButton2Click(Sender: TObject);
begin
  console.log( 
    WebClientDataSet1.Locate('_Length__cm_',
WebEdit1.Text,[loCaseInsensitive, loPartialKey])
  );
end;

the JSON file is:
{
"ROW": [
	{
		"_Species_No": "90020",
		"_Category": "Triggerfishy",
		"_Common_Name": "Clown Triggerfish",
		"_Species_Name": "Ballistoides conspicillum",
		"_Length__cm_": 50,
		"_Length_In": "19.6850393700787",
		"_Notes": "Also known as the big spotted triggerfish.  Inhabits outer reef
areas and feeds upon crustaceans and mollusks by crushing them with powerful
teeth.  They are voracious eaters, and divers report seeing the clown
triggerfish devour beds of pearl oysters.\r\n\r\nDo not eat this fish. 
According to an 1878 account, \"the poisonous flesh acts primarily upon the
nervous tissue of the stomach, occasioning violent spasms of that organ, and
shortly afterwards all the muscles of the body.  The frame becomes rocked
with spasms, the tongue thickened, the eye fixed, the breathing laborious,
and the patient expires in a paroxysm of extreme suffering.\"\r\n\r\nNot
edible.\r\n\r\nRange is Indo-Pacific and East Africa to Somoa.\r\n\r\n               
\r\n                \r\n                \r\n                \r\n               
"
	},
	{
		"_Species_No": "90030",
		"_Category": "Snapper",
		"_Common_Name": "Red Emperor",
		"_Species_Name": "Lutjanus sebae",
		"_Length__cm_": 60,
		"_Length_In": "23.6220472440945",
		"_Notes": "Called seaperch in Australia.  Inhabits the areas around lagoon
coral reefs and sandy bottoms.\r\n\r\nThe red emperor is a valuable food
fish and considered a great sporting fish that fights with fury when hooked. 
The flesh of an old fish is just as tender to eat as that of the very
young.\r\n\r\nRange is from the Indo-Pacific to East Africa.\r\n\r\n               
\r\n                \r\n                \r\n                "
	}
]}




--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list