Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
¿Cómo conseguir todas las hembras?

Me gustaría obtener el género para los cálculos, por ejemplo, las opciones masculina y femenina están en una columna. Me gustaría obtener todos los hombres o todas las mujeres para el cálculo.

Tengo una "propiedad calculada" que me da una lista de todos los elementos junto con el cálculo. Aquí está el código:

 partial void MeanFemale_Compute(ref string result) { // Set result to the desired field value int totalAge = 0; int count = 0; foreach (InsuranceQuotation i in his.DataWorkspace.ApplicationData.InsuranceQuotations) { totalAge += i.mAge; count++; } if (count != 0) { result = (totalAge / count).ToString(); } }

¿Cómo puedo filtrar el género en esta "propiedad calculada"?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Puede utilizar LINQ. Se vería algo como esto:

 int averageAge = this.DataWorkspace.ApplicationData.InsuranceQuotations. Where(iq => iq.Gender == Gender.Female). Average(iq => iq.mAge);
over 4 years ago · Santiago Trujillo Report

0

¿Podrías filtrar con una declaración if?

 partial void MeanFemale_Compute(ref string result) { // Set result to the desired field value int totalAge = 0; int count = 0; foreach (InsuranceQuotation i in this.DataWorkspace.ApplicationData.InsuranceQuotations) { if(i.Female == true) { totalAge += i.mAge; count++; } } if (count != 0) { result = (totalAge / count).ToString(); } }
over 4 years ago · Santiago Trujillo Report

0

Espero que esto ayude a alguien más a filtrar la lista de opciones en _InitializeDataWorkspace:

 // get count of females double fgender = (from gender in InsuranceQuotations where gender.mGender == "Female" select gender).Count(); //get sum of females ages double female = InsuranceQuotations.Where(x => x.mGender == "Female").Sum(t => t.mAge); // get count males double mgender = (from gender in InsuranceQuotations where gender.mGender == "Male" select gender).Count(); //get sum of males ages double male = InsuranceQuotations.Where(x => x.mGender == "Male").Sum(t => t.mAge); // MeanFmale amd MeanMmale - The fields that display MeanFmale = (female / fgender).ToString(); MeanMmale = (male / mgender).ToString();

O

 double fmale = InsuranceQuotations.Where(x => x.mGender == "Female").Average(t => t.mAge); double mmale = InsuranceQuotations.Where(x => x.mGender == "Male").Average(t => t.mAge); // MeanFmale amd MeanMmale - The fields that display MeanFmale = fmale.ToString(); MeanMmale = mmale.ToString();
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!