EDN Admin
Well-known member
Hi,
I am wondering if it is possible to return the a value using less than in LINQ? At the moment I am using a case statement to set MeterSqd.
So for example if MeterSqd was 1.25 and Type was Type0 then 1.08 would be returned, anything over 4 would use MeterSqd="4" so if if MeterSqd was 6 and Type was Type1 then 1.50 would be returned.
Many Thanksquery = (From c In doc.Descendants("Exposed")
Where c.Attribute("MeterSqd") = MeterSqd
Select c.Attribute(Type).Value)
For Each q In query
Debug.Print(q.ToString)
Next<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dataroot>
<Floor>
<Exposed MeterSqd="1" Type0="1.41" Type1="1.87" Type2="0.63" />
<Exposed MeterSqd="1.5" Type0="1.08" Type1="1.69" Type2="0.62" />
<Exposed MeterSqd="2" Type0="0.98" Type1="1.60" Type2="0.61" />
<Exposed MeterSqd="2.5" Type0="0.97" Type1="1.58" Type2="0.60" />
<Exposed MeterSqd="3" Type0="0.98" Type1="1.53" Type2="0.59" />
<Exposed MeterSqd="4" Type0="0.96" Type1="1.50" Type2="0.56" />
</Floor>
</dataroot>
View the full article
I am wondering if it is possible to return the a value using less than in LINQ? At the moment I am using a case statement to set MeterSqd.
So for example if MeterSqd was 1.25 and Type was Type0 then 1.08 would be returned, anything over 4 would use MeterSqd="4" so if if MeterSqd was 6 and Type was Type1 then 1.50 would be returned.
Many Thanksquery = (From c In doc.Descendants("Exposed")
Where c.Attribute("MeterSqd") = MeterSqd
Select c.Attribute(Type).Value)
For Each q In query
Debug.Print(q.ToString)
Next<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dataroot>
<Floor>
<Exposed MeterSqd="1" Type0="1.41" Type1="1.87" Type2="0.63" />
<Exposed MeterSqd="1.5" Type0="1.08" Type1="1.69" Type2="0.62" />
<Exposed MeterSqd="2" Type0="0.98" Type1="1.60" Type2="0.61" />
<Exposed MeterSqd="2.5" Type0="0.97" Type1="1.58" Type2="0.60" />
<Exposed MeterSqd="3" Type0="0.98" Type1="1.53" Type2="0.59" />
<Exposed MeterSqd="4" Type0="0.96" Type1="1.50" Type2="0.56" />
</Floor>
</dataroot>
View the full article