FMK Pro ESS access to Postgres

Discussion created by olddev94105 on Nov 13, 2018
Latest reply on Nov 13, 2018 by olddev94105

Hi I have an issue with ESS on FMK Pro Advanced version 17:

I have successfully created a DNS using Actual Tech (licensed version) to a PostGres database. In FM, I can see the tables in the PostGres database. Further, in the layouts based on these tables I can actually see the data and can perform finds. One of these tables is user_accounts (shown as public.user_accounts in FMK), which has a field called "username" and a index field named "id". Both these fields have valid values in the public.user_accounts layout.

Now I have a FM table named Staff. I create a field in Staff called G_UserID and enter a valid number that corresponds to the "id" field in public.user_accounts. I then create a UserName field in Staff, and specify that it is a Calculation field and enter this as the calculation:

ExecuteSQL ( "SELECT T.username FROM public.user_accounts T WHERE T.id = ?" ; "" ; "" ; G_UserID )

I ensure that this is not a stored field and not an index.


However, I only get a "?" as the value of this field!


To debug, I created a script (launched when opening the Staff layout) and created a variable $UserName and gave it the same calculation. However the variable also gets the same "?" (including when I changed "G_UserID" to "Staff::G_UserID" in the calculation.) The Get (LastError) function returns 0.


What could I be doing wrong? Or am I stretching the capabilities of FM? If the second, I can't build my app using FM and will have to use another tool.


Thanks in advance!