telerik grid detailtview Razor vb.net Syntax - razor

I need some help with the syntax
I have the Razor code below. But I do not get the detail view ok. When I use the code below the detail grid will be rendered and after that the normal customer grid. The object is a customer and a detail view are some settings for this customer? Can someone help me with the syntax?
Thanks!
#(Html.Telerik.Grid(Model) _
.Name("CustomerGrid") _
.DataBinding(Function(dataBinding) dataBinding.Server() _
.Update("SaveCustomer", "Admin")) _
.DataKeys(Function(keys) keys.Add(Function(o) o.CustomerID)) _
.DetailView(Function(dt) dt.Template(Sub(tt)
Html.Telerik.Grid(tt.MessageSettings) _
.Name("MessageSetting" & tt.CustomerID) _
.Columns(Function(dc) {
dc.Bound(Function(dd) dd.CustomerMessageSettingsID), _
dc.Bound(Function(dd) dd.Free)
}).Render
End Sub)) _
.Columns(Function(c) { _
c.Bound(Function(o) o.CompanyName).Width(200), _
c.Bound(Function(o) o.Credits), _
c.Bound(Function(o) o.Address), _
c.Bound(Function(o) o.City), _
c.Command(Function(d) { _
d.Edit.ButtonType(GridButtonType.Image) _
}) _
}) _
.Filterable _
.Groupable _
.Editable(Function(e) e.Mode(GridEditMode.InLine)) _
.Pageable() _
.Sortable() _
)

I recommend you to use LoadContentFrom()
.DetailView(details => details.ClientTemplate(
Html.Telerik().TabStrip()
.Items(items =>
{
items.Add().Text("MyView").LoadContentFrom("PartialActionResult", "Controller", New With { _
.param1 = "<#= ID#>" _
})
}) // End of item Tabs
.ToHtmlString()
) // End of Detail View Client Template
) // End of Detail View

Related

Foundry - Using tranforms verbs inmemory datastore to test incremental transforms

Im using the in-memory datastore approach to test incremental transform and im receiving the error below. Any idea what i might be doing wrong.
def test_transformdata_incr(spark_session):
df_input = spark_session.createDataFrame([
(1, 'abc', 1000, '2022-08-01'),
(2, 'abc', 2000, '2022-08-02'),
(3, 'def', 2000, '2022-08-01')
], ['a', 'b', 'c', 'd'])
df_expected = spark_session.createDataFrame([
('abc', 3000, '2022-08-12 15:10:00'),
('def', 2000, '2022-08-12 15:10:00')
], ['b', 's_colc', 'ts'])
transform_input = '/data/sampledata'
transform_output = '/data/sampledata_output'
pipeline = Pipeline()
pipeline.add_transforms(compute)
store = InMemoryDatastore()
store.store_dataframe(transform_input, df_input)
runner = TransformRunner(pipeline, datastore=store)
df_output = runner.build_dataset(spark_session, transform_output)
assert df_output.subtract(df_expected).count() == 0
assert df_expected.subtract(df_output).count() == 0
assert df_output.schema == df_expected.schema
Error:
df_output = runner.build_dataset(spark_session, transform_output)
myproject/tests/test_transformdata_incr.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../build/conda/env/lib/python3.8/site-packages/transforms/verbs/testing/TransformRunner.py:74:
in build_dataset
self._build_dataset_recursive(spark_session, alias) ../build/conda/env/lib/python3.8/site-packages/transforms/verbs/testing/TransformRunner.py:84:
in _build_dataset_recursive
self._build_derived(spark_session, alias) ../build/conda/env/lib/python3.8/site-packages/transforms/verbs/testing/TransformRunner.py:107:
in _build_derived
transform.compute(**kwargs)
self = <transforms.api._incremental._IncrementalCompute object at
0x7f1b6f9afd60> ctx =
<transforms.verbs.testing.dummies.DummyTransformContext object at
0x7f1b6e85c790> transform_ios = {'output':
<transforms.verbs.testing.dummies.DummyTransformOutput object at
0x7f1b6e85c730>, 'source_df':
<transforms.verbs.testing.dummies.DummyTransformInput object at
0x7f1b6e85c070>} tinputs = {'source_df':
<transforms.verbs.testing.dummies.DummyTransformInput object at
0x7f1b6e85c070>} toutputs = {} parameters = {'output':
<transforms.verbs.testing.dummies.DummyTransformOutput object at
0x7f1b6e85c730>}
def __call__(self, ctx=None, **transform_ios): # pylint: disable=arguments-differ
"""Run the computation by dynamically constructing IncrementalX objects from the general X objects.
TransformInput -> IncrementalTransformInput
TransformOutput -> IncrementalTransformOutput
TransformContext -> IncrementalTransformContext
"""
tinputs = {
name: tio for name, tio in transform_ios.items()
if isinstance(tio, _transform.TransformInput) and not isinstance(tio, _transform.TransformOutput)
}
toutputs = {
name: tio for name, tio in transform_ios.items() if isinstance(tio, _transform.TransformOutput)
}
parameters = {
name: param for name, param in transform_ios.items()
if not isinstance(param, _transform.TransformInput) and not isinstance(param, _transform.TransformOutput)
}
foundry = list(toutputs.values())[0]._dfreader._foundry # Kinda horrible, but we grab a foundry instance E IndexError:
list index out of range
../build/conda/env/lib/python3.8/site-packages/transforms/api/_incremental.py:169:
IndexError
I have found a work-around.
you can mock the decorator:
def _fake_incremental_decorator(trasnform_obj):
DummyTransformContext.is_incremental = False
return trasnform_obj
You can use then a context manager within the test to apply the mock:
with patch('transforms.api.incremental', return_value=_fake_incremental_decorator):
pipeline.add_transforms(compute)

setting confluence page title with atlassian-python-api

Is there a way of editing the title of a Confluence page using the atlassian-python-api?
I tried using
confluence.set_page_property(page_id, {'title': new_page_title})
but I get an error <Response [500]>
In detail:
pytest_test.py::test_remove_all_qqq_from_titles FAILED [100%]
venv\conversion_scripts\pytest_test.py:103 (test_remove_all_qqq_from_titles)
def test_remove_all_qqq_from_titles():
> toto = cu.remove_all_qqq_from_titles('TS')
pytest_test.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
convert_utils.py:286: in remove_all_qqq_from_titles
cc.set_page_property(page_id, {'title': new_page_title})
..\lib\site-packages\atlassian\confluence.py:1768: in set_page_property
response = self.post(path=url, data=json_data)
..\lib\site-packages\atlassian\rest_client.py:309: in post
response = self.request(
..\lib\site-packages\atlassian\rest_client.py:242: in request
self.raise_for_status(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <atlassian.confluence.Confluence object at 0x000001DAEAC19550>
response = <Response [500]>
def raise_for_status(self, response):
"""
Checks the response for an error status and raises an exception with the error message provided by the server
:param response:
:return:
"""
if 400 <= response.status_code < 600:
try:
j = response.json()
error_msg = j["message"]
except Exception:
response.raise_for_status()
else:
> raise HTTPError(error_msg, response=response)
E requests.exceptions.HTTPError
..\lib\site-packages\atlassian\confluence.py:2774: HTTPError

How can I determine why my JSON object fails?

In the following code, I am trying to get the data using ajax but it fails and alerts the error message in the ajax call.
I need the data in the object to populate a form. It just alerts "Ooop there is something wrong" in the error of the ajax call.
Please find below my ajax call. As I said previously it alert the error message and since it is not successful, nothing to show in the developer tool on my browser for console.log()
dim rstRev, strRevSQL
dim intReviewStatus
dim intReviewID
intReviewID = sqlsafe2(request("review_id"),2)
Set rstRev = Server.CreateObject("ADODB.Recordset")
strRevSQL = "exec ppsp_reviewDetails '" & intReviewID & "'"
rstRev.open strRevSQL, db,adOpenForwardOnly,adLockReadOnly
if not rstRev.EOF then
intValueScore = cint(rstRev("value_score"))
intQualityScore = cint(rstRev("quality_score"))
intReview_ID = intReviewID
reviewID = rstRev("review_id")
reviewDate = rstRev("review_date")
reviewEmail =rstRev("email")
pf_id = rstRev("pf_id")
product = rstRev("product_name")
reviewTitle =rstRev("review_title")
linkText = rstRev("link_text")
TT = cint(rstRev("t_and_t"))
reviewStatus = cint(rstRev("active"))
reviewText = rstRev("review_text")
ppResponse = rstRev("pp_response")
strJSON = "{" & _
"""success"": true," & _
"""intValueScore"":""" & intValueScore & """," & _
"""intQualityScore"":""" & intQualityScore & """," & _
"""intReview_ID"":""" & intReview_ID & """," & _
"""reviewID"":""" & reviewID & """," & _
"""reviewDate"":""" & reviewDate & """," & _
"""reviewEmail"":""" & reviewEmail & """," & _
"""pf_id"":""" & pf_id & """," & _
"""product"":""" & product & """," & _
"""reviewTitle"":""" & reviewTitle & """," & _
"""linkText"":""" & linkText & """," & _
"""TT "":""" & TT & """," & _
"""reviewStatus"":""" & reviewStatus & """," & _
"""reviewText"":""" & reviewText & """," & _
"""ppResponse"":""" & ppResponse & """" & _
"}"
%>
<%
end if
rstRev.Close
set rstRev = nothing
Response.Write(strJSON)
%>```
```$('tbody tr td a').click(function(e){
e.preventDefault()
var x =$(this).prop("href")
var y = x.indexOf("=")+1
revID = x.substring(y)
//alert (x)
$.ajax({
type:"POST",
dataType:"json",
async: true,
url:"/web_utils/ppgf_utils/ajax/xt-review_details05122019.asp",
data:{
review_id:revID
},
success:function(data){
window.scrollTo(0, 0)
if(data.success ==true){
console.log(data.success)
}
},
error:function(){
alert("Ooop Something is wrong")
}
});```

Format Now() to yyyymmdd for date serialization when exporting a PDF

How do I simply format the now() function to a string to name a file that needs a date in it so I don't over write files when I export them?
My reason for asking is I need to export a report to a PDF and I need the name of the PDF in the file location to be:
DoCmd.OutputTo acOutputReport, _
"Issue_invsnapshotR", acFormatPDF, _
"\\SPFS1\Stone\Quality\Support Docs\Issues\" & _
[issue_id] & _
"\inv_snapshot_for_issue_" & _
Me.issue_id & _
"_on_" & _
???yyyymmdd function??? & _ <-----unknown function here
".pdf", _
False, _
"", , acExportQualityPrint
The unknown function is this:
Format(now(), "yyyymmdd")
The finished code looks like this:
DoCmd.OutputTo acOutputReport, _
"Issue_invsnapshotR", acFormatPDF, _
"\\SPFS1\Stone\Quality\Support Docs\Issues\" & _
[issue_id] & _
"\inv_snapshot_for_issue_" & _
Me.issue_id & _
"_on_" & _
Format(Now(), "yyyymmdd") & _
".pdf", _
False, _
"", , acExportQualityPrint
this function will return a string of (today being 3/8/17) 20170308. which can be used to serialize files and folders.

Run Code error in Access Macro

I am trying to make a macro in Access that will run VBA code. I trying am using the RunCode command to Run a function that will run a VBA function that I have already created but for some reason it says it can't find it and I am really confused why. I have posted a picture of the macro as well as the code below. Any help would be greatly appreciated.
Macro:
http://imgur.com/uankmL0
Code:
Function Totals()
Dim db As Database
Set db = CurrentDb
foldername = CurrentProject.Path & "\GeneralTotals"
deleteTotals = "DELETE * FROM Totals"
totalVerified = "INSERT INTO Totals([TOTAL VERIFIED FORMULARIES], [TOTAL AVAILABLE FOR IMPORT], [TOTAL SHOULD BE IMPORTED], [TOTAL RECENTLY IMPORTED]) " & _
"SELECT A.cnt, B.cnt, C.cnt, D.cnt " & _
"FROM ( " & _
"SELECT COUNT([FORMULARY ID]) as cnt " & _
"FROM VerifiedFormularies " & _
") AS A " & _
", ( " & _
"SELECT COUNT([FORMULARY ID]) as cnt " & _
"FROM ImportMetricsIDs " & _
") as B " & _
", ( " & _
"SELECT COUNT([FORMULARY ID]) as cnt " & _
"FROM ShouldImportMetricsIDsTable " & _
"WHERE [IMPORTSTATUS]= 'Yes' " & _
") AS C " & _
", ( " & _
"SELECT COUNT([LATEST]) as cnt " & _
"FROM VerifiedFormularies " & _
"WHERE [LATEST]= 'Yes' " & _
") AS D "
db.Execute deleteTotals
db.Execute totalVerified
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel5, "Totals", foldername
MsgBox ("Totals have been exported to: " & foldername)
End Function
Your issue most likely depends on location of trigger event and code placement.
How are you triggering the RunTotals macro? With an embedded macro
using the RunMacro action or in VBA using DoCmd.RunMacro?
Where is the Function Totals() placed? It needs to be behind the form
triggering the event or in a module.
Finally, you can avoid using separate objects (RunTotals macro and embedded macro) if in your trigger event, you type into the Property sheet event line "=Totals()" Alternatively, you can simply call the function in VBA with the simple line: Totals. But location as explained in second bullet still applies.