Fatal Error function Pos in WEBLib.TMSFNCStyles

Hello,

I installed my new development environment (Delphi 10.4 enterprise; TMS ALL ACCESS) with the Web Core components and try to compile my actually project.
With the new environment I am not able to compile my project. I get a fatal error message:

Blockquote[Fehler] WEBLib.TMSFNCStyles.pas(972): Wrong number of parameters specified for call to "function Pos(const String;const String)"

Can you support me, what I have to do, that I can fix that. It comes also by a new project.

Many thanks
Patrick

Our FNC products have already been adapted to TMS WEB Core v1.6. That is the reason for this issue.
It will work fine when you update to the latest TMS WEB Core v1.6 beta available on your account.

Ok, I installed the beta.
At first I had to delete some links to *.res files
for example:

{$R 'TMSFNCBitmapContainer.res'} WEBLib.TMSFNCBitmapContainer
{$R 'TMSFNCStyles.res'} WEBLib.TMSFNCStyles

Now I get the message:

[Fehler] TTVC_Data_ModuleUnit.pas(13): identifier not found "TIntegerField"

How can I fix that?

Many thanks
Patrick

There must be something wrong with your install.
No changes should be needed, it should work all out of the box.

Did you FIRST fully uninstall TMS WEB Core v1.5.6.0 (via Windows Control Panel) before installing v1.6.0.0 beta?

Hi Bruno,

you are right. I did not removed the Web Core before. I did it, but it needs some restarts. In the first times I had the same error. But after I created a new Projekt and added a WebDataSet with integer fields it worked. And after that in my old project the message left and I can compile.

But it seems, that now there are issues with the webdataset… But the old project is not so important for me, because I started a new one (same topic) with a new structure.

But I am not able to get the connection between the WebApp and the server.

I always get the message:

ERROR
TXDataWebConnection is not connected | fMessage::TXDataWebConnection is not connected fHelpContext::0
at http://localhost:8000/TVC_Project/TVC_Project.js [259:48]

But I did it…

procedure TMySQL.WebDataModuleCreate(Sender: TObject);

begin

xData_Main_Connect.Connected:=true;

if xData_Main_Connect.Connected then

ShowMessage('connected')

else

ShowMessage('Not connected');

end;

Here I get the message ‚Not connected‘. When I connect it in designtime, I get no mistake, but the result is the same…

Do you have an idea, why I am not able to connect the WebApp to the server?

Many thanks

Patrick

This never works. The connection is done asynchronously, thus when the second line is executed, it is still not connected. You have to use the OnConnect event, that will be fired after the connection has been established.

Hi Wagner,

you are so right! I always make mistakes the asynchronously database… The connection works and the service delivers data.

But I have problems to work with them:

procedure TMySQL.JSON_DataSet(DataSet: TXDataWebDataSet;

Response: TXDataClientResponse);

var JSAr: TJSArray;

begin

JSAr := TJSArray(TJSJSON.parse(Response.ResponseText));

DataSet.Close;

DataSet.SetJsonData(JSAr);

DataSet.Open;

DataSet.Active:=true;

end;

I want to bring them in a WebDataSet. And in the debugger I see the data in the dataset (see picture). But I do not know but I cannot work with them.

image001.png

When I ask for a DataField I get the message:

procedure TForm_TVC_Main.button_newreg_loginClick(Sender: TObject);

begin

ShowMessage(MySQL.DataSet_Sprache.FieldByName('sprache_text').AsString);

end;

ERROR
Uncaught TypeError: Cannot read property 'GetJSONDataForField$1' of null | TypeError: Cannot read property 'GetJSONDataForField$1' of null at Object.GetFieldData$1 (http://localhost:8000/TVC_Project/TVC_Project.js:107021:34) at Object.GetFieldData (http://localhost:8000/TVC_Project/TVC_Project.js:82602:21) at Object.GetData (http://localhost:8000/TVC_Project/TVC_Project.js:79168:36) at Object.GetAsString (http://localhost:8000/TVC_Project/TVC_Project.js:79288:16) at Object.button_newreg_loginClick (http://localhost:8000/TVC_Project/TVC_Project.js:109150:116) at Object.cb [as FOnClick] (http://localhost:8000/TVC_Project/TVC_Project.js:242:19) at Object.Click (http://localhost:8000/TVC_Project/TVC_Project.js:30981:61) at Object.HandleDoClick (http://localhost:8000/TVC_Project/TVC_Project.js:30489:31) at HTMLButtonElement.cb (http://localhost:8000/TVC_Project/TVC_Project.js:238:26)
at http://localhost:8000/TVC_Project/TVC_Project.js [107021:34]

What is my mistake?

Many thanks

Patrick

Hard to tell what's going on. I don't have an idea now. I'd ask you provide more details and/or a project that can reproduce the problem.

Hi Wagner,

I tried to create a test-app but it doesn’t work. In my real project the procedure JSON_Data works and I am looking for a solution to get access tot he data in the dataset. In the test-app the procedure JSON_Data also failed…

Can you have a look on it and can you me explain, what I am doing wrong with both buttons?

Many thanks

Patrick

Test_App.zip (32.7 KB)

Hi Wagner,

did you get the sample project and did you find the reason of my problems?

Many thanks

Patrick

Hi Patrick,

I had pretty much the same problem. It turned out I kept installing ver 1.5 even though I'm sure I was selecting 1.6 beta. I eventually confirmed the version I was using by going to the windows "Apps and Features" an in the "search the list" I typed "core" to filter for the "TMS WEB Core Wrapper Installer for Delphi v1.6.0.0". Once I was able to confirm it had the 1.6 version my problems went away.

Hope this helps,
Andrew

Hi Andrew,
many thanks for support. I did the same and now I see in the program list, that I installed v1.6.0.0. That solved the first problems. I am able to compile my project.

WebCore_1600

But now I am not able to access of the data in a TWebDataSet. It seems that the handle with the TWebDataSet is different, but I am not sure.

I tried it with the TxDataWebDataSet:

procedure TMySQL.JSON_DataSet(DataSet: TXDataWebDataSet;
Response: TXDataClientResponse);
var JSAry: TJSArray;
begin
JSAry := TJSArray(TJSJSON.parse(Response.ResponseText));
DataSet.Close;
DataSet.SetJsonData(JSAry);
DataSet.Open;
DataSet.Active:=true;
end;

and I tried it with the TWebClientDataSet:

procedure TMySQL.JSON_WCD(DataSet: TWebClientDataSet;
Response: TXDataClientResponse);
var JSAry: TJSArray;
begin
JSAry := TJSArray(TJSJSON.parse(Response.ResponseText));
DataSet.Close;
DataSet.Rows:=JSAry;
DataSet.Open;
DataSet.Active:=true;
end;

In the debugger in both procedures I can see, that the data are available in the FRows. But if I ask for a specific field I get an error message.

ERROR
Uncaught TypeError: Cannot read property 'GetJSONDataForField$1' of null | TypeError: Cannot read property 'GetJSONDataForField$1' of null at Object.GetFieldData$1 (http://localhost:8000/TVC_Project/TVC_Project.js:107021:34) at Object.GetFieldData (http://localhost:8000/TVC_Project/TVC_Project.js:82602:21) at Object.GetData (http://localhost:8000/TVC_Project/TVC_Project.js:79168:36) at Object.GetAsString (http://localhost:8000/TVC_Project/TVC_Project.js:79288:16) at Object.button_newreg_loginClick (http://localhost:8000/TVC_Project/TVC_Project.js:110573:113) at Object.cb [as FOnClick] (http://localhost:8000/TVC_Project/TVC_Project.js:242:19) at Object.Click (http://localhost:8000/TVC_Project/TVC_Project.js:30981:61) at Object.HandleDoClick (http://localhost:8000/TVC_Project/TVC_Project.js:30489:31) at HTMLButtonElement.cb (http://localhost:8000/TVC_Project/TVC_Project.js:238:26)
at http://localhost:8000/TVC_Project/TVC_Project.js [107021:34]

If I ask for the RecordCount I get 0 as result, but in the debugger it seems, that there are 3 lines in it... See attached picture.

DataSet_Data_with data

Then I tried to fill the DataSet manuelly:

procedure TMySQL.Add_Manuelly(DataSet: TXDataWebDataSet);
begin
DataSet.Open;
DataSet.Active:= true;
DataSet.Insert;
DataSet.FieldByName('sprache_text').AsString:='Italy';
DataSet.Post;
end;

But at the line DataSet.Insert, I get the error-message:

ERROR
xWDS_Sprache : Operation cannot be performed on an inactive dataset | fMessage::xWDS_Sprache : Operation cannot be performed on an inactive dataset fHelpContext::0
at http://localhost:8000/TVC_Project/TVC_Project.js [83830:7]

I do not know what I am doing wrong...

Many thanks
Patrick!

Your JSON is incorrect. You used a memo with word wrap thus you have wrapped lines. Copy and paste into https://jsonlint.com and you will see the problems. Once the JSON is fixed everything works fine.

Hi Wagner,

many thanks for replay. You are right, that was the reason, why I could not prepare the example. I deactivate WordWrapping and add the JsonString again into the memo, then it works well.

But in my real project I do not work with a memo. So tried to fixed it, but I was not able… I wanted to understand, why the example works, but my real project not.

So I add a DataModule in the example project, like I have it in my real project. I moved the TWebDataSet to it. I did not change something else but then I got the same error-message in the example project like in the real project.

ERROR
Uncaught TypeError: Cannot read property 'GetJSONDataForField$1' of null | TypeError: Cannot read property 'GetJSONDataForField$1' of null at Object.GetFieldData$1 (http://localhost:8000/Project1/Project1.js:53964:34) at Object.GetFieldData (http://localhost:8000/Project1/Project1.js:48098:21) at Object.GetData (http://localhost:8000/Project1/Project1.js:44664:36) at Object.GetAsString (http://localhost:8000/Project1/Project1.js:44784:16) at Object.WebButton2Click (http://localhost:8000/Project1/Project1.js:62138:77) at Object.cb [as FOnClick] (http://localhost:8000/Project1/Project1.js:242:19) at Object.Click (http://localhost:8000/Project1/Project1.js:30981:61) at Object.HandleDoClick (http://localhost:8000/Project1/Project1.js:30489:31) at HTMLButtonElement.cb (http://localhost:8000/Project1/Project1.js:238:26)
at http://localhost:8000/Project1/Project1.js [53964:34]

In the debugger it looks like that the data are in the dataset, but the FState of the DataSet is 0 instead of 1.

image001.png

What is the difference when I place the DataSet on a DataModule and what do I have to do, that the DataSet is active? The Statement DataSet.active:=true doesn’t help.

Many thanks for support

Patrick

Test_App_with_DataModule.zip (47.5 KB)

We fixed this issue. Was related to data modules. v1.6 will address this.

Great information! Is there a date for the release?

v1.6 release is imminent. We release when no more issues popup from all our testing.

MANY THANKS! It works fine!!!

Now I can go further!!!

1 Like