i have two NSDates and i want to check if a third one is between those others.
But now, even if i know that the date i want to check is between the others,
it says its not. Maybe one of you can help me.So the if-clause is always TRUE.
Thanks a lot!!
current = [ar objectAtIndex:j];
gameDate = [current gameDate];
gameDate = [gameDate substringToIndex:[gameDate length] - 9];
GameDay = [df dateFromString:gameDate];
if(![GameDay compare:start] == NSOrderedAscending && ![GameDay compare:end] == NSOrderedDescending){
[DateArray addObject:[ar objectAtIndex:j]];
}
You can try simply using the NSDate NSTimeInterval (which is really just a typeDef for double) and comparing like this:
if ([myCheckDate timeIntervalSince1970] < [mybetweenDate1 timeIntervalSince1970] && [myCheckDate timeIntervalSince1970] > [mybetweenDate2 timeIntervalSince1970])
Hope that helps.
Related
I am strugglying with a problem that is to access the reference of the end point of a pipe curve to then create a dimension in the model, by the method doc.Create.Dimension().I already tried to use the Curve.EndPointReference(int index) method but it returns only null value. Can anyone help how to access this information ?
Also discussed and answered here by Fair59:
https://forums.autodesk.com/t5/revit-api-forum/endpointreference/td-p/7131328
The answer is also pointed to from The Building Coder:
http://thebuildingcoder.typepad.com/blog/2011/10/retrieving-duct-and-pipe-endpoints.html#comment-3344122037
Fair59's answer:
You probably are using the LocationCurve to find the reference. You need to use the "reference" Curve/Line that is part of the Element.Geometry.
Selection sel = this.ActiveUIDocument.Selection;
Element elem = doc.GetElement(sel.GetElementIds().FirstOrDefault());
Options opt = new Options();
opt.ComputeReferences = true;
opt.IncludeNonVisibleObjects = true;
opt.View = doc.ActiveView;
Reference ptRef =null;
foreach( var geoObj in elem.get_Geometry(opt) )
{
Curve cv = geoObj as Curve;
if (cv==null) continue;
ptRef = cv.GetEndPointReference(0);
}
if (ptRef!=null)
{
TaskDialog.Show("debug",ptRef.ConvertToStableRepresentation(doc));
}
I think you should try something like
yourPipe.Location.Curve.GetEndPoint(1)
This will give you the XYZ object of the end point of your curve.
Regards,
Arnaud.
In the following I will describe a simplification of my Core Data schema that I am pretty sure to be equivalent to my real situation.
I have two entity First and Second linked by a many-to-many relationship r.
Second has got two Boolean attribute, let us call it take and you_should_not_take.
I want to make a query that select a row of First iff it exits an associated row of Second for with take = true.
I have tried this predicate:
NSPredicate(format: "ANY (%K == YES && %K == NO)", "r.take","r.you_should_not_take")
but Core Data gives me the following error: "[General] Unable to parse the format string".
Maybe I have to use this:
NSPredicate(format: "((ANY %K == YES) && (ANY %K == NO))", "r.take","r.you_should_not_take")
but I am afraid that this last query will select a row of First iff it exists a row x of Second for which x.take == YES && it exists a row y if Second for which y.you_should_not_take == NO, with no guarantee that x == y.
An SQL query would be very simple to be made, but I am not so experienced with Core Data, so while I will try some more queries (and I will test if the second query does what I think it does) I have also asked here hoping the answer would be as simple as in SQL.
To select all First objects which are related to (at least one) Second object for which take==true and you_should_not_take==false you have
to use a SUBQUERY. Something like (untested):
SUBQUERY(r, $x, $x.take == YES AND $x.you_should_not_take == NO).#count > 0
I checked a lot of topics on stack's about my issue, but every resolution don't work for me.
So please help me with two things.
1) I want to delete column 'M'.
I checked $excelObj->getActiveSheet()->removeColumn('M'); (Doesn't work)
2) I have got a bit of code:
//ISP MCR FULLAUTOMAT
for ($row = 1;$row <= $lastrow; $row++) {
if(strpos(($worksheet->getCell('K'.$row)->getValue()), $orion_automat) !== false) {
if((strpos(($worksheet->getCell('J'.$row)->getValue()), $mcr_isp_full) !== false) and
(strpos(($worksheet->getCell('J'.$row)->getValue()), $mcr_isp_full_anal) == false)) {
$full++;
}
}
}
After the $full++; I want to make something like that:
If script will add +1 to $full, he will also write 1 in the column "N" in a $row.
I tried this:
$excelObj->getActiveSheet()->setCellValue('N'.$row, '1');
And this:
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow('N', $row, '1');
If someone has got a little bit time to help, please write what I can try more.
Thank you.
Yours faithfully - Mariusz Adamczewski
I've tried getComponent("ComboBoxID").getChildCount() but that appears to not return the correct number. Anyone know if there is a method I can use? Or maybe a function needs to be created?
EDIT - And is there a way to loop through the options and get the values like in CSJS?:
for (var i = 1; i < comboBox.options.length; i++){
pmtPlan = comboBox.options[i].value;
...
Maybe this XSnippet can help:
http://openntf.org/XSnippets.nsf/snippet.xsp?id=get-selectable-values-of-a-component
Instead of printing the selectable value(s) you have to count them.
Hope this helps
Sven
Today, I'm having a problem is after I had created a Calculated field. It seems there is no way to add AllContentTypes. And the DefaultView, maybe I can handle this. And I also saw this method:
spList.Fields.AddFieldAsXml(spFieldUser.SchemaXml, True, SPAddFieldOptions.AddToAllContentTypes);
But in this case, I'm not sure I can use it or not. Because my code is:
//SPField tempSPField = spList.Fields.CreateNewField(createSPColumnObject.ColumnType, createSPColumnObject.ColumnName);//We can not use this code line for creating Calculated (there is no constructor for this)
SPFieldCollection collFields = spList.Fields;
string strSPFieldCalculatedName = collFields.Add(createSPColumnObject.ColumnName, SPFieldType.Calculated, false);
if (createSPColumnObject.IsAddedToDefaultView)
{
SPView spView = spList.DefaultView;
spView.ViewFields.Add(strSPFieldCalculatedName);
spView.Update();
}
SPFieldCalculated spFieldCalculated = null;
//
spFieldCalculated = (SPFieldCalculated)collFields[createSPColumnObject.ColumnName];
spFieldCalculated.ShowInDisplayForm = true;
//spFieldCalculated.ShowInEditForm = true;
spFieldCalculated.ShowInListSettings = true;
//spFieldCalculated.ShowInNewForm = true;
spFieldCalculated.ShowInViewForms = true;
//
spFieldCalculated.Description = createSPColumnObject.ColumnDescription;
spFieldCalculated.Formula = string.Format(#"={0}",createSPColumnObject.CalcFormula);
spFieldCalculated.Update();
//spList.Fields.AddFieldAsXml(spFieldCalculated.SchemaXml, createSPColumnObject.IsAddedToDefaultView, SPAddFieldOptions.AddToAllContentTypes);// also use this code line because we will get an exception with a duplicate column ID.
spFieldCalculated.OutputType = SPFieldType.Text;
spList.Update();
I totally created a Calculated column but how can I add it to allcontent types ? everybody could help me out this ? BTW, to the DefaultView, I did like the above is right ? Could eveybody let me know this ?
I just worry about everybody get misunderstanding ? Or review with missing code. So could everybody please to take a look on my code clearly ? Thanks all.
Many thanks, :)
Standley Nguyen
I'm not sure if i fully understand what you are trying to do however i may be able to shed some light on some parts of what you are trying to do.
When you create your field does it then appear in your site actions -> site settings -> Site columns. If so you have created this correctly. If it doesn't there are hundreds of examples of how to do this if you search google.
Once you have your field create you then need to consider which content types you want to add it to. Once you have these content types you then have to add something called a field link to the Content type.
This isn't my code i have picked it off the web but this should do what you require.
SPContentType ct = web.ContentTypes[contentType];
ct.FieldLinks.Add(new SPFieldLink(field));
ct.Update();
Cheers
Truez