Return Formatted page with data from 1 record

Trying to get something to work that I assume should be easy but I can’t figure out how to get it to work.

I am trying to create a Work Order page from my job database. All of the info is contained in one row in my database. The webpage that will call the page will be something like "http://www.aaa.com/show_workorder.php?jobnumber=[jobnumber] (the bracketted job number will be the actual job number).

I tried to create the databinding to grab the data --> Select * from jobs where jobnumber = {{jobnumber}}. I can’t seem to get this to work from the server. If I change the query to "Select * from jobs where jobnumber = 12345, I am able to browse to the resulting data fine.

{“jobinfo”:[{“jobID”:“12345”,“jobnumber”:“2828623”,“PO_Number”:“55555”,“coname”:“SomeCo”,“bill_Address”:“123 Street”,“bill_City”:“SomeCity”,“bill_State”:“CA”,“bill_Zip”:“90000”,“phone”:“310-555-1275”,“Time_In”:null,“Date_In”:null,“Job_Title”:“Some bcards",“email”:"tim@aol.com”,“Quantity”:null,“JobType”:“Offset Printing”,“Notes”:null,“BinderyNotes”:null,“PressNotes”:null}]}

For setting up the php file, I basically just want to put something like this:

Job Number: {{returns job number}}
Job Title: {{returns job title}}
etc.

I looked at the docs and saw how to create a table with multiple values but I can seem to just display single variables. Sorry if this is basic but I haven’t quite figured out wapplers way of doing it.

Thanks for you help.

Tom Komin

Hi Tom,
no problem at beginning it need little time to enter in the logic of the program.
(I go by memory having not the computer with me).

  1. on appconnect panel click on App and below in the properties You will find the button: DEFINE QUERY PROPERTIES or something similar. Click it and add the variable who will use the page. According your example a variable should be name jobnumber. In this way the page will recognized the value passed by the address.

  2. On server connect make a script to query the table you need, but on Globals right click on GET and and a variable ( call it jobnumber)

In the query add the table and filter it using jobID is equal to … Click on the electric sign who is the dynamic data picker and you will see the jobnumber variable. Click on it. save the query file.

  1. on appconnect panel add a server connect. choose the file you did and on the properties panel you will see like:

jobnumber…and the dynamic data picker.
Click on the dynamic data picker and in the panel opened by the program you will see the App/jobnumber variable you created before. Select it.

Now you binded the variable passed by URL to the query.

Now you can make a table with all variables or just bind the variable you need .

To just add a variable binding without table:
click on the line of text you want the value appear and on the appconnect panel at bottom choose: Data bindings. You will get the panel with all server connect of the page. Select the server connect, data, query and at the end the value you wants.

As said before. I went by memory… Then if something is not clear tell me tomorrow morning will send you some screenshot.

Roberto

1 Like

Thanks for this info. I was able to add the variable “jobnumber” and it can be displayed (if i use “{{query.jobnumber}}” but I couldn’t get any of the retrieved values from the database ({{serverconnect1.data.jobinfo[0].coname}}). I know i am not doing something right. I don’t see Globals on “server connect”.

Thanks for your help again.

Tom

Hello @tomkomin
Here it is described how to filter your data using an URL parameter: https://github.com/Wappler/docs/wiki/Filtering-Database-Query-with-an-URL-Parameter

The latter part of this video on filtering a search may assist.
http://wapplerunwrapped.online/videoplayer.php?id=2

Thanks Teodor and everyone else. I was able to get this to work following the instructions from https://github.com/Wappler/docs/wiki/Filtering-Database-Query-with-an-URL-Parameter.

Last Question on this (hopefully):

I have a text from the database that has a character return in it (“BinderyNotes”:“Cut to 8.5 x 11\r\n3-hole drill”) that I want to change to <BR> so that it will display properly. How can I achieve this?

Thanks once again,
Tom

Hello @tomkomin
wrap your bindings with a <pre></pre> tag and the \r\n will be properly handled. However it’s better to save these like <br> in your database.