object cant inherit properties - object

I get stack. PLZ help.
In class "work" i creating a frame of a table. Than in object "myWork1" i must fill that frame of a table.
But it didnt works. Finally i want to creating a table with special information in it.
What im doing wrong?
<p id="demo">demo</p>
function work(td1) {
this.firstWork = function(){
var table = document.createElement("table");
var table_tr = document.createElement("tr");
var table_td = document.createElement("td");
var table_td_text = document.createTextNode(this.td1=td1);
table_td.appendChild(table_td_text);
table_tr.appendChild(table_td);
table.appendChild(table_tr);
io.appendChild(table);
}
}
var myWork1 = new work("111");
document.getElementById("demo").innerHTML =
return myWork1.tableWork();

<p id="demo">demo</p>
function work(td1) {
this.firstWork = function(){
var table = document.createElement("table");
var table_tr = document.createElement("tr");
var table_td = document.createElement("td");
var table_td_text = document.createTextNode(td1);
table_td.appendChild(table_td_text);
table_tr.appendChild(table_td);
table.appendChild(table_tr);
return table;
}
}
var myWork1 = new work("111");
document.getElementById("demo").appendChild(myWork1.firstWork());
A working example here : jsfiddle

Related

Add dimension between link and element

i am tried to find the link wall face,but when i use the reference to create a new dimension , i will get result about 'invaild number of references'. i cant trans link face to active face.
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
var rf1 = uidoc.Selection.PickObject(ObjectType.PointOnElement, "select");
var element1 = doc.GetElement(rf1);
var location = element1.Location as LocationPoint;
var point = location.Point;
var rf2 = uidoc.Selection.PickObject(ObjectType.LinkedElement, "select");
var linkElement = doc.GetElement(rf2) as RevitLinkInstance;
var linkDoc = linkElement.GetLinkDocument();
var linkWall = linkDoc.GetElement(rf2.LinkedElementId) as Wall;
var wallLocation = linkWall.Location as LocationCurve;
var curve = wallLocation.Curve;
var cRf = curve.Reference;
var solid = BIMTools.Geometry.GetSolid(linkWall);
Face face = null;
foreach (var solidFace in solid.Faces)
{
XYZ normal = ((Face)solidFace).ComputeNormal(new UV(0, 0));
if (normal.Y < 0)
{
face = solidFace as Face;
break;
}
}
var viewLevel = uidoc.ActiveView.GenLevel.Elevation;
var tPoint = new XYZ(point.X,(face as PlanarFace).Origin.Y, viewLevel);
point = new XYZ(point.X, point.Y, viewLevel);
var line = Line.CreateBound(point, tPoint);
var references = new ReferenceArray();
references.Append(rf1);
references.Append(face.Reference);
using (Transaction trans = new Transaction(doc,"create"))
{
trans.Start();
var dimension = doc.Create.NewDimension(uidoc.ActiveView, line, references);
trans.Commit();
}
return Result.Succeeded;
}
The Building Coder provides a whole list of articles on creating dimensioning.

How to Add New Custom record Item in netsuite using webservices?

I have created a new custom record called "XYZ" and i created all the fields into it.
Now i can add new entry on that Custom record using GUI but how do i do similar action using webservices.
What methods needs to be summoned to add new item in custom record type and how do we do it.
Any help would be greatly appreciated.
Thank You
Below is the sample C# code to add custom record using SuiteTalk (webservices) -
CustomRecord customRecord = new CustomRecord();
RecordRef recordType = new RecordRef();
recordType.internalId = "14"; // // Record Type's internal ID (Setup > Customization > Record Types > Basic Record Type (Internal ID=14)
recordType.type = RecordType.customRecord;
recordType.typeSpecified = true;
customRecord.recType = recordType;
customRecord.internalId = "7"; // internal id of the custom record you want to update
StringCustomFieldRef stringCustomFieldRef = new StringCustomFieldRef();
stringCustomFieldRef.scriptId = "custrecord_pe_pbmastertrackno";
stringCustomFieldRef.value = txtMasterTrackno.Text.Trim();
CustomFieldRef[] customFieldRef = new CustomFieldRef[1];
customFieldRef[0] = stringCustomFieldRef;
customRecord.customFieldList = customFieldRef;
_service = new NetSuiteService();
setPassport(); // Set the Passport information for authentication
WriteResponse writeResponse = _service.add(customRecord);
Hope this will help you.
Thanks.
You can create new restlet with following code and call restlet using post method with recordtype and field values
function createNewRecord(datain){
var recType = datain.recordtype;
var field1 = datain.field1;
var field2 = datain.field2;
var field3 = datain.field3;
var record = nlapiCreateRecord(recType);
record.setFieldValue('custrecord_field1', field1);
record.setFieldValue('custrecord_field2', field2);
record.setFieldValue('custrecord_field3', field3);
var id = nlapiSubmitRecord(record, true);
var dd = JSON.stringify(id);
return dd;
}
Restlet Call
var account = 'XXXXXXX';
var email = 'XXXX#domain.com';
var signature = 'XXXXXXXX';
var role = '3';
var recordtype = 'XYZ';
var custrecord_field1 = 'value1';
var custrecord_field2 = 'value2';
var custrecord_field3 = 'value3';
var newRec = {"recordtype": recordtype, "field1":custrecord_field1, "field2":custrecord_field2, "field3":custrecord_field3}
var url = 'https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=231&deploy=1';
var params = {
contentType: 'application/json',
headers:{Authorization: 'NLAuth nlauth_account='+account+', nlauth_email='+email+', nlauth_signature='+signature+', nlauth_role='+role},
method: 'POST',
muteHttpExceptions: true,
payload: JSON.stringify(newRec)
};
var response = UrlFetchApp.fetch(url, params);
var resdata = JSON.parse(response.getContentText());
Logger.log(resdata);

How to get individual object's width, height, left and top in selection:created event?

I am getting the values of the properties of an object(top,width...) as an object is being scaled/moved by using this function :
canvas.on('object:scaling', onObjectModification);
canvas.on('object:moving', onObjectModification);
canvas.on('object:rotating', onObjectModification);
function onObjectModification(e) {
var activeObject = e.target;
var reachedLimit = false;
objectLeft = activeObject.left,
objectTop = activeObject.top,
objectWidth = activeObject.width,
objectHeight = activeObject.height,
canvasWidth = canvas.width,
canvasHeight = canvas.height;
}
How can I get the same for each object that are being moved as a group? I need the values to be constantly changing as the object:scaling event provide.
I know of the event selection:created but I am lost how to use that to attain what I want. Any help from you guys would be highly appreciated.
Thanks
during object scaling width and height will not change. They will be the same all the time, just scaleX and scaleY will change.
You have to write a function that will iterate on possibile group sub objects.
canvas.on('object:scaling', onObjectModification);
canvas.on('object:moving', onObjectModification);
canvas.on('object:rotating', onObjectModification);
function onObjectModification(e) {
var activeObject = e.target;
if (!activeObject) {
return;
}
var canvasWidth = canvas.width;
var canvasHeight = canvas.height;
var reachedLimit = false;
var objectLeft = activeObject.left;
var objectTop = activeObject.top;
// this provide scaled height and width
var objectWidth = activeObject.getWidth();
var objectHeight = activeObject.getHeight();
if (activeObject._objects) {
objs = activeObject._objects;
for (var i= 0; i < objs.length; i++) {
var obj = objs[i];
var objWidth = activeObject.getWidth() * activeObject.scaleX;
var objHeight = activeObject.getHeight() * activeObject.scaleY;
}
}
}

CAML query contains does not work

I've got this code, which takes a part of the title to perform a query and filter part of the content of a list:
<script type="text/javascript">
var items_lista;
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', Initialize);
function Initialize() {
var PDP_Link_Filter = $("title").text().split("-")[1].split(".")[0];
PDP_Link_Filter = "Link_" + PDP_Link_Filter + "_";
var contexto = SP.ClientContext.get_current();
var web = contexto.get_web();
var listas = web.get_lists();
var parametros = listas.getByTitle('Parametrizacion_WF');
var query = new SP.CamlQuery();
query.set_viewXml("<Query><Where><Contains><FieldRef Name='Title'/>" +
"<Value Type='Text'>" + PDP_Link_Filter + "</Value></Contains></Where></Query>");
console.log(query);
items_lista = parametros.getItems(query);
contexto.load(items_lista);
contexto.executeQueryAsync(Function.createDelegate(this, this.onRequestSucceeded), Function.createDelegate(this, this.onRequestFailed));
} //Initialize
function onRequestSucceeded()
{
console.log(items_lista);
for(i = 0; i < items_lista.get_count(); i++)
{
console.log(items_lista.get_item(i).get_item('Title'));
}
}
function onRequestFailed() { console.log('Error'); }
</script>
The query filter that it generates (obtained through console.log()):
<Query><Where><Contains><FieldRef Name='Title'/><Value Type='Text'>P000</Value></Contains></Where></Query>
But when the for loop runs it shows all the content of the list not just the rows that match the filter.
What am I doing wrong?
This is most probably related with malformed value for SP.CamlQuery.viewXml property. Since this property expects XML schema that defines the list view, the root element has to be View element, for example:
var ctx = SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle(listTitle);
var items = list.getItems('<View Scope="RecursiveAll"><Query></Query></View>');
In your case enclose the query with View element:
<View>
<Query>...</Query>
</View>

YUI DataTable with TEXT responseType

//Define the columns of the table
var myColumnDefs = new Array();
for ( i=0; i < $names.length ; i++)
{
var colObjConfig = new Object();
colObjConfig.label =$names[i];
colObjConfig.resizeable =true;
colObjConfig.width =150;
myColumnDefs.push ( new YAHOO.widget.Column(colObjConfig));
}
var beginningScoreRow = "1111,1111|1111,1111";
var myDataSource = new YAHOO.util.FunctionDataSource( function () {
return beginningScoreRow ;} );
myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
myDataSource.responseSchema = {
fieldDelim : ",",
recordDelim : "|"
};
var myDataTable = new YAHOO.widget.DataTable("statusTable", myColumnDefs,
myDataSource);
I want to use TYPE_TEXT responseType for a YUI DataSource. But the above failed to render the data in the YUI table column cells. I do not see any error in JS console either.
What am i missing?
var column = new YAHOO.widget.Column(colObjConfig);
column.field = ""+i+"";
myColumnDefs.push (column );
Changed the column definition to add the field property and it did the trick...

Resources