This topic is locked
[SOLVED]

 ViewControl.Format() not working?

9/13/2019 3:23:57 PM
ASPRunner.NET General questions
Pete K author

Can anyone confirm that ViewControl.Format() is still working in version 10.2? I'm using it but it is returning raw unformatted values, rather than the "display as" values as set in the UI.
Here's some code I'm using:

XVar data = button.getCurrentRecord();

result["record"] = data;

string requestor = ViewControl.Format(data,"Requestor","Requests").ToString();

string ReqDate = ViewControl.Format(data,"ReqDate","Requests").ToString();

string ReqTime = ViewControl.Format(data,"ReqTime","Requests").ToString();

string School = ViewControl.Format(data,"School","Requests").ToString();

string Student = data["StudentName"];

string NatureOfEvent = ViewControl.Format(data,"Reason","Requests").ToString();

string Interpreter = ViewControl.Format(data,"Interpreter","Requests").ToString();

result["URL"] = XSession.Session["AppRoot"].ToString() + "/feedback/add?RequestID=" + data["ID"].ToString() + "&Requestor=" + requestor

+ "&ReqDate=" + ReqDate + "&ReqTime=" + ReqTime + "&School=" + School + "&Student=" + Student + "&NatureOfEvent=" + NatureOfEvent + "&Interpreter=" + Interpreter;


And here's the relevant part of the resulting URL:
RequestID=45860&Requestor=PKOUTOUL&ReqDate=2019-08-16%2000:00:00&ReqTime=14:00:00&School=007&Student=Jane%20Doe&NatureOfEvent=7&Interpreter=1317
As you can see, the date and time fields are not formatted, and the lookup fields (Requestor, School, NatureOfEvent, Interpreter) are not showing the PK display values. All of these have been set in ASPRunner.NET for the Requests table and are displaying correctly in the generated app on the pages associated with that table.
Is there something wrong with my code or is this a possible bug?

jadachDevClub member 9/22/2019

I just tested this in an email. It worked as expected.

"+ViewControl.Format(values, "JobID", "dbo.Apply").ToString()+"

admin 9/23/2019

Pete,
we would need to see your project on Demo Account if you need us to troubleshoot either issue.

Pete K author 9/25/2019

There is no problem. It was my error.