So I have 3 Data Types. A district can represent more than one county and a county can have more than one district.
County
CountyName (String)
District
DistrictName (String)
Countys (Multi Select Dropbox)
Candidate
Name (String)
DistrictName (String)
I want the template to generate
County A
-->District 1
--->John
--->Bill
--> District 2
----->Susan
County B
-->District 1
---->John
----->Bill
--> District 3
----->Jack
----->Jane
Is there any way to use the visual editor and or Razor to achieve the many to many relationship needed for this?
Thanks!
Michael
So here's what I did ... I ended up pulling the full queries then using value filters inside nested loops.
It would be really nice if we could simply pass parameters from razor to a sqldatasource but since that doesn't seem to be available we get something like this:
#using ToSic.Eav.DataSources
var allCounties = App.Query["Counties"]["Counties"];
var allHouseDistricts = App.Query["Districts"]["MDHouseDistricts"];
#foreach (var thisCounty in AsDynamic(allCounties.List)) {
#thisCounty.CountyName
#{
var someHouseDistricts = CreateSource<ValueFilter>(allHouseDistricts);
someHouseDistricts.Attribute = "DistrictCounties";
someHouseDistricts.Value = thisCounty.CountyName;
someHouseDistricts.Operator = "contains";
}
#foreach (var thisHouseDistict in AsDynamic(someHouseDistricts.List)) {
#thisHouseDistict.HouseDistrictName
}
}
Here is the page that we built:
https://www.mdrealtor.org/Legislative/Resources/Home-Ballot
Related
let thisHotel: number = this.$("#hotelsList").val(); // the selected hotel Id value for the one I want..
let hotels2 = this.getModel().get("hotels"); // all the hotels
I have the selected hotel I want in my massive array...
I can see the hotels in the debug by doing specifically
console.log(hotels2.hotels);
thisHotel currently = 4 which is the value of one of the hotels.
Loop through hotels2 then the object is under hotels then the specific Id is 4.
I need to get the entire object for the specific hotel where Id = 4
I know there are a number of ways to do this. Some people may use Javascript and some people may use Jquery. What would you do?
Every example I see is always referring to a simple array with one or two values.
This is a more complex object.. I guess these are just the way it works in real life examples.
I'm a newbie so please help me get my bearings ...
I did it this way... if you have better suggestions let me know please...
let foundHotel;
//console.log("Hotel Count=" + hotels2.hotels.length);
for (var i = 0; i < hotels2.hotels.length; i++) {
var x = hotels2.hotels[i];
console.log("Looping thru " + x.Id + " checking for " + thisHotel);
if (x.Id == thisHotel) {
console.log("Match on " + x.HotelInformation.Name);
foundHotel = hotels2.hotels[i];
break;
}
}
console.log(foundHotel);
Then I use jquery to prepopulate my form with the info about the selected hotel....
$("#HotelName").val(foundHotel.HotelInformation.Name);
$("#HotelChainCode").val(foundHotel.HotelInformation.ChainCode);
I want to plot the count of burn pixels for modis burned area product within my geometry regions called "table" for only agricultural pixels (obtained from 'lc' image collection). I couldn't find anything in the docs to indicate you can do such a query between 2 image collections. Anyone have any suggestions?
I have tried using a mask, but it seems that this might only work on individual ee.Image not between different image collections. The code is shown below:
var modba = ee.ImageCollection('MODIS/006/MCD64A1').filterDate('2017-01-
01', '2017-12-31').select('BurnDate')
var modbaN = ee.ImageCollection('MODIS/006/MCD64A1').filterDate('2017-01-
01', '2017-12-31').select('Uncertainty')
var lc = ee.ImageCollection('MODIS/006/MCD12Q1').filterDate('2017-01-01',
'2017-12-31').select('LC_Type1')
var AgOnly = lc.map(function(img) {
var ag = img.select('LC_Type1');
return ag.eq(12);
//Would also like to maybe have 2 or 3 LC types to select here
});
var mask_ba = modba.map(function(img){
return img.updateMask(AgOnly);
});
var bats =
//ui.Chart.image.seriesByRegion(modba, table, ee.Reducer.count());
ui.Chart.image.seriesByRegion(mask_ba, table, ee.Reducer.count());
print(bats);
var unts =
ui.Chart.image.seriesByRegion(modbaN, table, ee.Reducer.mean());
print(unts);
It's still doable with a wider date range and several land cover types.
In that case, just keep your old code that calculates AgOnly, and modify the code that calculates mask_ba as below:
var mask_ba = modba.map(function(img){
var img_year = img.date().format('YYYY');
var start_date = ee.Date(img_year.cat('-01-01'));
var end_date = start_day.advance(1, 'year');
var Agri_this_year = AgOnly.filterDate(start_date, end_date).max();
return img.updateMask(Agri_this_year);
});
Basically, the above code just extracts the year of the current img, then use filterDate method to select the land type cover of that year from AgOnly image collection, and finally apply updateMask.
The same idea could be applied to other land cover types.
Hope this helps.
As I understand, what you're trying to do is to mask each image in modba image collection (which has 12 images or one per month) by the corresponding image in AgOnly image collection (which has only 1 image for the whole year). That's totally doable.
In your provided code, you're updateMask using AgOnly (an image collection) which is not allowed by GEE.
All you need to do is just make AgOnly an image before using it for updateMask.
Try this:
var AgOnly = lc.map(function(img) {
var ag = img.select('LC_Type1');
return ag.eq(12);
//Would also like to maybe have 2 or 3 LC types to select here
}).max();
The max() method will convert your image collection into an image. You can also use min() or mean() if you like, which will all give the same result as there's only one image in AgOnl anyway.
Hi im relatively new to c# code and i was wondering if there is any way to get the amount of columns and rows in a grid and store that amount in a variable
Something like:
var columnamount = grid.columnamount;
But i could not find anything that works
Thanks
You can use the following code to get a count of the columns and rows directly via the ColumnDefinitions and RowDefinitions properties. No need to enumerate the children of the grid because you may not have views in every column/row.
var columnCount = grid.ColumnDefintions.Count;
var rowCount = grid.RowDefinitions.Count;
For reference the documentation.
You might be able to do it this way, purely based on what I see in the docs:
var countColumns = grid.Children.Where( c => c.Column).Max();
var countRows = grid.Children.Where( c => c.Row).Max();
But I'm not sure if you can access Row anf Column properties on the child element.
This is not the best way to check, I guess, but it's working (same thing for columns):
EDIT: nope, for columns it doesn't work
int GetRowsCount(Grid grid)
{
var item = grid.Children.FirstOrDefault();
return item != null ? Grid.GetRow(item) + 1 : 0;
}
I just started a new Project _NewEnglandPatriots.
EDTs:
FirstName (extends Name)
SecondName(extends Name)
LastName (extends Name)
Position (String)
PlayerBirthday (Date)
JerseyNumber (Integer)
Tables:
SycTeamRoster (I've dragged all my EDTs to the "Fields" of the table)
Forms:
TeamRoster (I've dragged all the fields into my SimpleList design)
I have inserted the following player data to the form without a problem:
Thomas Edward
Patrick
Brady
12
Quarterback
03.08.1977
Next I wrote a Job insertTeamMembers, within which I insert the member with the following code:
static void insertTeamMembers(Args _args)
{
SycTeamRoster newEnglandTable;
container teammembers;
container conTake;
int i;
;
teammembers = [["Khashayar" ,"Goudarzi", 1, "Quarterback", 28,02,1990]];
ttsBegin;
for(i=1; i<=conLen(teammembers); i++)
{
conTake= conPeek(teammembers,i);
newEnglandTable.clear();
newEnglandTable.SycVorname = conPeek(teammembers,1);
newEnglandTable.SycNachname = conPeek(teammembers,2);
newEnglandTable.SycJerseyNumber = conPeek(teammembers,3);
newEnglandTable.SycPosition = conPeek(teammembers,4);
newEnglandTable.SycPlayerBirthday = conPeek(teammembers,5);
newEnglandTable.insert();
}
ttsCommit;
}
The problem is that I get the following data to the Form and Table:
FirstName: Khashayar
SecondName: empty, but because I left it that way
LastName: empty
JerseyNumber: 0
FieldPosition: 0
Birthday: empty
What is causing these empty fields in the table?
These lines are using teammembers instead of conTake
newEnglandTable.SycVorname = conPeek(teammembers,1);
Change to
newEnglandTable.SycVorname = conPeek(conTake,1);
And the way you have data entered in your nested container, specifically 28,02,1990 is going to be a problem.
This appears to be a learning exercise, so I don't want to solve the entire thing for you.
I have 2 List one stores the name of filterable columns(of type DropDown) and another store the values to load in those filterable columns.
List<string> filterableFields = new List<string>() { "A_B", "C_D", "E_F" };
List<string> AB, CD , EF;
Now at the run time I get the data from web service and I have written a function to to extract values for these filterable fields and store the values to 2nd List.
private void prepareListForFilterableColumns(XDocument records)
{
foreach (var currentField in filterableFields)
{
var values = (from xml in records.Descendants(z + "row")
let val = (string)xml.Attribute("ows_" + currentField.Replace("_", "_x0020_"))
where val != ""
orderby val
select val
).Distinct();
switch (currentField)
{
case "A_B": AB = values.ToList(); break;
case "C_D": CD = values.ToList(); break;
}
}
}
Now I was thinking that instead of hard coding the assignment in swtich case block, If I could just use the first List name "A_B" and replace "_" from it to point to my 2nd List and assign values.ToList() to it.
I understand that c# is a static language, So not sure if we can achieve this, but IF I can it will make my function generic.
Thanks a lot in advance for time and help.
Vishal
You could use a dictionary of lists of strings instead of 3 lists to store the values.
Dictionary<string, List<string>> val lists = new Dictionary<string,List<string>>();
And make the keys of the dictionary equal to the filterables: "AB", "CD",..
then, instead of AB you would use valLists["AB"] and could then reference reach list based on a string key.
The other option would be to use reflection but that would be slower and unnecessarily a bit more complicated.