Telegram_2020-10-29T14

<< Click to Display Table of Contents >>

Navigation:  Telegram > 2020 > 10 > 29 >

Telegram_2020-10-29T14

Telegram link

 

2020-10-29T14:02:07

 

I'm perplexed... It's not like I am trying to do something complicated ;)

 


 

Telegram link

 

2020-10-29T14:02:53

 

after your page loads and you can see that there are rows displaying — add a button that reads a value from the dataset and write it to a TIWLabel, just for debug purposes

 


 

Telegram link

 

2020-10-29T14:03:07

 

if you can see the text there, then it's simply a grid issue

 


 

Telegram link

 

2020-10-29T14:03:25

 

Also — quick question — are you pooling your data module?

 


 

Telegram link

 

2020-10-29T14:08:47

 

No pooling, that was the default when I create it, and I had no idea what that meant so I left it ;)

 


 

Telegram link

 

2020-10-29T14:09:04

 

The grid is populating with data from my query just fine...

 


 

Telegram link

 

2020-10-29T14:09:33

 

so the problem is solved?

 


 

Telegram link

 

2020-10-29T14:12:36

 

No, the grid will only display data if I do not assign any columns

 


 

Telegram link

 

2020-10-29T14:13:09

 

Interestingly, when I try setting a label caption to a value from my data, I get a \This page isn't working\ (code 500) in my browser...

 


 

Telegram link

 

2020-10-29T14:13:30

 

All I'm doing is setting Caption to FieldByName().AsString

 


 

Telegram link

 

2020-10-29T14:13:55

 

in what lifecycle event are you opening the data?

 


 

Telegram link

 

2020-10-29T14:14:07

 

IWButton.OnClick

 


 

Telegram link

 

2020-10-29T14:14:43

 

that will work

 


 

Telegram link

 

2020-10-29T14:15:28

 

It does

 


 

Telegram link

 

2020-10-29T14:15:35

 

...unless I define cloumns?!

 


 

Telegram link

 

2020-10-29T14:15:49

 

OK, let me try it myself

 


 

Telegram link

 

2020-10-29T14:16:27

 

I am going to try moving the data components out of my data module and into the UserSessionUnit. Perhaps that is confusing things somehow?

 


 

Telegram link

 

2020-10-29T14:16:50

 

the user session is a data module, basically

 


 

Telegram link

 

2020-10-29T14:17:25

 

and everything that you want in your session — that you don't want other users to see — has to go on your session

 


 

Telegram link

 

2020-10-29T14:17:42

 

You I just had a lot of premade stuff I wanted to loop in from a data module so I used that...

 


 

Telegram link

 

2020-10-29T14:18:08

 

so — the db connection needs to go on the session — so that each user gets their own

 


 

Telegram link

 

2020-10-29T14:18:21

 

because most db connection components are NOT thread safe

 


 

Telegram link

 

2020-10-29T14:18:28

 

Right

 


 

Telegram link

 

2020-10-29T14:18:37

 

which is why I pool my data connections

 


 

Telegram link

 

2020-10-29T14:18:44

 

otherwise I get thousands of connections to the db

 


 

Telegram link

 

2020-10-29T14:19:04

 

which doesn't make sense on several levels

 


 

Telegram link

 

2020-10-29T14:19:22

 

the amount of memory used on the server would be crazy

 


 

Telegram link

 

2020-10-29T14:19:23

 

I was instantiating the data module in the UserSession create event anyway, but this is such a simple application that containing what I need in the usersession will be fine

 


 

Telegram link

 

2020-10-29T14:19:31

 

and the db engine wouldn't appreciate so many connections to it

 


 

Telegram link

 

2020-10-29T14:19:40

 

I see

 


 

Telegram link

 

2020-10-29T14:19:52

 

OK, I'll go try a TIWDBGrid and I'll report back

 


 

Telegram link

 

2020-10-29T14:20:14

 

Thank you so much! I will let you know if moving things into the user session works

 


 

Telegram link

 

2020-10-29T14:26:13

 

OK removed my secondary data module entirely. Grids still work the same, only now I can set the label caption without errors

 


 

Telegram link

 

2020-10-29T14:27:13

 

I think I was referncing the data module directly instead of the one the usersession owned so it was likely throwing an access violation

 


 

Telegram link

 

2020-10-29T14:27:37

 

in your page/form — do NOT put the user session unit in your uses clause

 


 

Telegram link

 

2020-10-29T14:27:56

 

you can only get access to your UserSession through your ServerController

 


 

Telegram link

 

2020-10-29T14:28:18

 

the ServerController has a special function whose only job is to give you access to your session

 


 

Telegram link

 

2020-10-29T14:30:00

 

It is not... I am setting the IWDBGRid.DataSource to UserSession.dsTest at runtime

 


 

Telegram link

 

2020-10-29T14:30:11

 

good

 


 

Telegram link

 

2020-10-29T14:33:45

 

So is assigning iwdbg1.DataSource := UserSession.dsTest correct? i.e. referencing hte usersession in this way is valid?

 


 

Telegram link

 

2020-10-29T14:34:00

 

I mean it must be?! Since the label and grids work

 


 

Telegram link

 

2020-10-29T14:34:59

 

if your UserSession is the function in the ServerController — then you are golden

 


 

Telegram link

 

2020-10-29T14:35:04

 

Yup

 


 

Telegram link

 

2020-10-29T14:35:34

 

It just returns Result := TIWUserSession( type: link WebApplication.data );

 


 

Telegram link

 

2020-10-29T14:35:46

 

But that's all boilerplate stuff, I have not touched it'

 


 

Telegram link

 

2020-10-29T14:38:42

 

Were you able to get an IWDBGrid to display properly with columns defined?

 


 

Telegram link

 

2020-10-29T14:38:52

 

This has to be a grid problem as the data seems to be working properly

 


 

Telegram link

 

2020-10-29T14:38:58

 

still working on it

 


 

Telegram link

 

2020-10-29T14:57:26

 

I guess following the isolation logic (of restricting data stuff to the usersession) there is no way to assign the .DataSource property of databound controls at design time?

 


 

Telegram link

 

2020-10-29T14:57:48

 

I have seen people do it temporarily, in order to get design-time data

 


 

Telegram link

 

2020-10-29T14:58:02

 

But I have also seen people forget to remove the pieces afterwards

 


 

Telegram link

 

2020-10-29T14:58:49

 

Only way I can see to do that would be to add the UserSessionUnit to the main form's uses clause which kind of violates the separation

 


 

Telegram link

 

2020-10-29T14:59:10

 

yes

 


 

Telegram link

 

2020-10-29T14:59:44

 

I have weaned myself away from design-time data when developing web apps

 


 

Telegram link

 

2020-10-29T14:59:58

 

OK well that makes sense... I will do the same