How do I put a new Database field into an existing grid?

Hi,

I habe an grid which corresponds to a database table (MySQL). Now I have to add another field to the table and I want to show it in the grid too.
What’s the best way to do this?
I tried to add the field to the SQL-Select statement and then to add it to the field list by using the function “New Field”. The field shows up in the grid put the values are not shown. What’s wrong here?

Thank you very much
Arno

Re: How do I put a new Database field into an existing grid?

Add the field to the SQL statement. ‘New field’ is for calculated fields only. I think since you added the ‘New Field’ it is overriding the data field. After you add it to the SQL statement, then go to Selected Fields and add it to the list of displayed fields.

beware: I have seen that adding a new field to a grid SQL ‘sometimes’ wipes out all the fields and you have to start over! This has not happened to me in the latest version so perhaps this is fixed. Make sure you export your app/project and do a backup first.

Regards,
Scott.

Re: How do I put a new Database field into an existing grid?

Thank you for your fast reply!
I tried it your way several time but this does not work. The new field does not show up in the “Select Fields” Dialog or anywhere else.

Any other help?

Thank you very much
Arno

Re: How do I put a new Database field into an existing grid?

Did you remove the field from the list of fields first? The one you created using ‘New Field’
Perhaps the SQL saw the ‘new’ field and ignored adding it?

Verify again that it is in your SQL statement. It will only display in Select Fields if you SQL contains the field.

If you create a new test grid, does the field get listed in the SQL and Selected Fields?

Regards,
Scott.

Re: How do I put a new Database field into an existing grid?

Hi Scott,

I have made some further tests and suddenly the field appears. I am not really sure what’s the clue. Maybe it depends on the formatting of the SQL-Statement regarding spaces and Tabs within it.
Well - thank you very much anyway :slight_smile:

Best regards
Arno

Re: How do I put a new Database field into an existing grid?

Hi everyone,

I am having this problem as well. And everything reported here is accurate. I have a grid application with sql statement, all fields appear and I can add them etc. Then today I needed to change the sql statement and copied the new works in sql builder and gives results sql statement into the sql area in the grid. But, none of the new fields show up to add them…

This has to be a bug. I have tried resaving, regenerating code and building the application and now it just shows like 2 fields and is not using the new sql statement and not really using what I originally had in there either.

How do I fix this? Can someone from Scriptcase look into this?

Normally, I have run into few bugs like this in SC and SC is amazing! :slight_smile:

help -

David

Re: How do I put a new Database field into an existing grid?

I used debug mode and this is my new sql I am trying to get to work:

SELECT
  session.idSession,
  session.idleader,
  employee.idemployee,
  concat(employee.lastName,', ',employee.firstName) as EmpName,
  employee.employeeID,
  concat(departments.deptName,'(',employee.departments_iddepartments,')') as EmpDept,
  employee.yearsServiceCurrent as YOSCurrent,
  employee.yearsServiceTotal as YOSTotal,
  employee.hireDate as HiredDate,
  employee.salaryGrade,
  employee.jobTitle as EmpTitle,
  codes_current.idemployee,
  codes_current.idSession,
  codes_current.date,
  codes_current.idsystem_codes,
  codes_current.devPlan,
  codes_current.turnoverProbability as TOProb,
  codes_current.currPerfAppraisal as CurrPerfAppr 
FROM
  session INNER JOIN codes_current ON session.idSession = codes_current.idSession
  INNER JOIN employee ON codes_current.idemployee = employee.idemployee
  INNER JOIN departments ON employee.departments_iddepartments = departments.iddepartments
WHERE 
  (session.idSession = '5')

But this is what was output in debug in the app:

(mysql): SELECT session.idleader as session_idleader, session.idSession as session_idsession from session INNER JOIN codes_current ON session.idSession = codes_current.idSession INNER JOIN employee ON codes_current.idemployee = employee.idemployee INNER JOIN departments ON employee.departments_iddepartments = departments.iddepartments where (session.idSession = '5') LIMIT 0,17  

Like I said, the sql works in the sql builder and gives me results and works perfectly.

The application originally had a different sql statement, and when I updated it to the above, this is when I started getting this debug output…

thanks for any help anyone can give…

David

Re: How do I put a new Database field into an existing grid?

It would help for you to post the schema of each table.

Regards,
Scott.

Re: How do I put a new Database field into an existing grid?

Hi Scott -

I will do that as needed definitely to help identify what is going on. Kinda weird given the sql works against those tables when run in sql builder. Should things that work in sql builder not work in the application?

I just wonder if I understand this correctly:

If I update the sql and press “save” for the application then… I should see the fields available get updated and can then add new fields or see fields vanish based on sql … and that happens automatically, correct?

thanks

David

Re: How do I put a new Database field into an existing grid?

After updating your grid, the ‘Select Fields’ property should be automatically populated with all the fields in your SQL statement.
You may have to report this to bugs@netmake.com.br

Regards,
Scott.

Re: How do I put a new Database field into an existing grid?

hi this issue has been fixed?