xmlvb.netlinqnodesxquery

Filtering Nodes and Join with other element to get caption


I have this xml

<?xml version="1.0" encoding="UTF-8"?>
<BRDatasetNode RootNodeType="Entersoft.Framework.Platform.CustomCommands.BRDatasetNode, ESCustomNode" Version="2" CGID="32482657-c400-49c9-ac44-9acf9ed235f2" Dataset="ESTMTask">
  <system_rules CGID="4abad517-c668-4f0b-8f2f-13688766ddea" />
  <custom_rules CGID="148102cc-57f1-4d78-bd97-5eabcb907035">
    <CustomRule CGID="487fcfe8-6713-4b44-ade4-52135a4b1b14">
      <Elems CGID="d4e7ca55-897a-443b-8bf2-bd65a48ba167">
        <BRElemNode CGID="945caa64-6d09-444e-ab07-420b63602283" table="ESTMTaskItem">
          <conditions CGID="b934df83-c7f7-4a94-bc2c-7ccc5e8c6249" />
          <ValidityConditions CGID="f9f686e5-8935-4018-a1e8-546597c76f35" />
          <ExecuteMessageConditions CGID="558ec6c7-7cfb-4c6a-aa2d-61f3ebbe3583" />
          <OnFieldChangedTriggerNode CGID="9c635981-8cbc-4e97-b320-de71c252ec7e">
            <columns CGID="ff03d233-645e-4b60-92e7-cf213e424844">
              <Column CGID="3add61ad-e531-4eae-9c27-f99fd9a749f6" column_name="FlagField1" reset_old_value="True" if_previous_value_was_null="True" />
            </columns>
          </OnFieldChangedTriggerNode>
          <InternalProfileActionNode CGID="3b7e66d6-fa8f-45e3-bd9c-25a710a84d74">
            <Profile CGID="18d708e3-a170-4560-8b0d-7208ba6ad775" UILess="True" Identity="True" Save="False">
              <SourceEntity EntityID="ESTMTask" />
              <TargetEntity EntityID="ESTMTask" />
              <SaveExpression CGID="b53498a6-9621-4c78-996b-c6a4fa3f99b6">
                <Supplier>
                  <EnumValue Type="Entersoft.Framework.Platform.Helper.SaveEnum, ESEntity" Value="ACTIONS_ONLY" />
                </Supplier>
              </SaveExpression>
              <RootRule CGID="e6b96cbd-bbd5-4fc5-919c-4c7cb864c9db" Source="ESTMTaskItem" Target="ESTMTask">
                <ExecuteSimpleConditions CGID="b6178af6-4249-4b14-80dd-07d07a0a8f71" />
                <Variables CGID="11a45c98-b27e-423c-a491-50017051ff0e" />
                <Rules CGID="334a4c2c-7523-49c6-be8e-76d8483c79de">
                  <Rule CGID="9bf97e09-9385-40ca-b3a7-d6e8fe8de4fe" Target="FK_ESTMTaskItem_ESTMTask" TargetKey="GID">
                    <ExecuteSimpleConditions CGID="4e517701-1310-4be7-b7c5-a35d47daf80b" />
                    <Variables CGID="c4813313-e3c3-4951-b7ce-bb206ae50cdd" />
                    <Rules CGID="55055039-a759-411a-8271-09a3d8e40e7b" />
                    <Conditions CGID="02b5dae4-a3c5-49e6-a41c-1fc4908f2831">
                      <Condition CGID="b53bd729-7210-4e22-8b1c-ff16b087408d">
                        <Supplier CGID="af4dd1db-6ad7-4445-bef1-8d745c706bcb">
                          <ExpressionValue>dim tbl as dataTable
dim dr as dataRow

tbl = _dr.Table

for each dr in tbl.Rows
    if not dr("GID").Equals(_dr("GID")) then 
        dr("FlagField1") = 0 
    end if 
next 

return true</ExpressionValue>
                        </Supplier>
                        <FormatParams CGID="addce3fc-ef34-4b3f-8b00-c81fccd7daef" />
                      </Condition>
                    </Conditions>
                    <Assignments CGID="6d207d92-b744-4522-87a1-b9731cd618fc">
                      <Assign CGID="200bfbd9-f3d5-4295-a926-cd241d720486" Column="GID">
                        <Supplier>
                          <SourceValue>GID</SourceValue>
                        </Supplier>
                        <Conditions CGID="b0b376b8-520c-4ecd-9849-af5dfe08a73f" />
                      </Assign>
                      <Assign CGID="79778eda-e893-4681-b4c1-244565e89f31" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField1">
                        <Supplier>
                          <SourceValue>StringField1</SourceValue>
                        </Supplier>
                        <Conditions CGID="fbdeb6ff-b0da-45dc-b2d2-e966ca96895c" />
                      </Assign>
                      <Assign CGID="981822e8-b1ff-4beb-8c7d-73d878a32aab" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField2">
                        <Supplier>
                          <SourceValue>StringField2</SourceValue>
                        </Supplier>
                        <Conditions CGID="39df7e42-87bc-4605-a4e0-8527db6b08f4" />
                      </Assign>
                      <Assign CGID="3d87fcf3-4065-430b-86ff-164407bc25bf" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField3">
                        <Supplier>
                          <SourceValue>StringField3</SourceValue>
                        </Supplier>
                        <Conditions CGID="11a5c947-ae51-4433-9d37-0d67325a6aa3" />
                      </Assign>
                      <Assign CGID="8c8b63d4-9066-48e8-8afb-8dd3378b130d" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField4">
                        <Supplier CGID="77d6a97d-0499-4515-a9af-d29c0e26cf55">
                          <Param CGID="49f1cdb4-03d2-4833-aa2e-718321c9f45b" ParamName="@myID">
                            <Supplier>
                              <SourceValue>NumericField1</SourceValue>
                            </Supplier>
                          </Param>
                          <Param CGID="37545cde-ad7a-4228-82c9-ea05c8625f1c" ParamName="@LineSoutce">
                            <Supplier>
                              <SourceValue>NumericField3</SourceValue>
                            </Supplier>
                          </Param>
                          <SQLSelectValue>Select top 1 WP.[fCountryCode]
From [CS_V_AA_Web_Persons] WP
Where myID = @myID And
      LineSource = @LineSoutce</SQLSelectValue>
                        </Supplier>
                        <Conditions CGID="75b4403b-d81a-4e1d-8de8-d5924f6d25da" />
                      </Assign>
                      <Assign CGID="838c2f8a-28e5-4fc2-9c38-43ed3ef6daec" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField5">
                        <Supplier>
                          <SourceValue>StringField5</SourceValue>
                        </Supplier>
                        <Conditions CGID="5a0e0c92-a946-474b-9670-668133d48316" />
                      </Assign>
                      <Assign CGID="492cc789-3562-4d16-9df0-fcf1dd1a3695" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField6">
                        <Supplier>
                          <SourceValue>StringField6</SourceValue>
                        </Supplier>
                        <Conditions CGID="cac8a9f7-72b6-4e1d-ae67-83e2a87f8123" />
                      </Assign>
                      <Assign CGID="4909531f-30f4-4e39-bbab-ef5945edec0d" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField7">
                        <Supplier>
                          <SourceValue>StringField7</SourceValue>
                        </Supplier>
                        <Conditions CGID="ed13bff1-5633-4f6a-ab6b-b222d4e823cc" />
                      </Assign>
                      <Assign CGID="33fbef6e-0594-44bc-a78c-d9b3742924c8" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField8">
                        <Supplier>
                          <SourceValue>Comments</SourceValue>
                        </Supplier>
                        <Conditions CGID="9368ac44-e26f-4356-bb56-85f6311662b8" />
                      </Assign>
                      <Assign CGID="4e15b65f-5785-4472-9a6a-c79cb37c0f6e" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField9">
                        <Supplier>
                          <SourceValue>StringField9</SourceValue>
                        </Supplier>
                        <Conditions CGID="feaa66a6-0f1f-49a1-ad97-a93247018c48" />
                      </Assign>
                      <Assign CGID="aab9ee4f-2726-4734-9506-1aa5d002d732" Path="FK_ESTMTaskItem_ESTMTask" Column="StringField10">
                        <Supplier>
                          <SourceValue>StringField10</SourceValue>
                        </Supplier>
                        <Conditions CGID="65b2bdc6-0edf-4916-8e02-b884f1c766e1" />
                      </Assign>
                      <Assign CGID="148dbecc-66db-4a38-8b21-b6a69cb65740" Path="FK_ESTMTaskItem_ESTMTask" Column="NumericField1">
                        <Supplier>
                          <SourceValue>NumericField1</SourceValue>
                        </Supplier>
                        <Conditions CGID="9de4a014-5222-44be-b411-5c393a7a2e6b" />
                      </Assign>
                      <Assign CGID="a8113b7f-d91b-496a-a10e-7635b27171c7" Path="FK_ESTMTaskItem_ESTMTask" Column="NumericField2">
                        <Supplier>
                          <SourceValue>NumericField2</SourceValue>
                        </Supplier>
                        <Conditions CGID="7408e64e-39c0-4eb5-ba34-9e131f894ebc" />
                      </Assign>
                      <Assign CGID="6cf108e7-a288-4c54-bf03-bba7164da4e9" Path="FK_ESTMTaskItem_ESTMTask" Column="NumericField3">
                        <Supplier>
                          <SourceValue>NumericField3</SourceValue>
                        </Supplier>
                        <Conditions CGID="f709b9b6-2148-4d94-b3e2-d668f6493618" />
                      </Assign>
                      <Assign CGID="c490e37c-7ee5-4f7d-b736-1ed295f15940" Path="FK_ESTMTaskItem_ESTMTask" Column="fTradeAccountGID">
                        <Supplier CGID="31661d34-c181-4b94-8621-cfe9dadbd326">
                          <Param CGID="9d34ab1a-305c-49c1-830a-694618cb701e" ParamName="$fTradeAccountGID">
                            <Supplier>
                              <SourceValue>fTradeAccountGID</SourceValue>
                            </Supplier>
                          </Param>
                          <ExpressionValue>if ESNULL($fTradeAccountGID,"00000000-0000-0000-0000-000000000000").ToString() = "00000000-0000-0000-0000-000000000000"
    return System.DBNull.Value
Else
    return $fTradeAccountGID
End if </ExpressionValue>
                        </Supplier>
                        <Conditions CGID="8d974f00-5f07-4101-94dc-322b381fccf2" />
                      </Assign>
                    </Assignments>
                    <OrderByNodes CGID="af9085c3-8eae-4fb7-a408-c0f3caee3afe" />
                    <GroupByNodes CGID="c59aa86f-db80-49c4-8535-1e812ec8392a">
                      <GroupAtMostEntries CGID="85f7acfc-daa0-4192-a1cc-393fd9896463">
                        <Supplier>
                          <ConstantValue>0</ConstantValue>
                        </Supplier>
                      </GroupAtMostEntries>
                    </GroupByNodes>
                    <MultiplyByNodes CGID="7c35a181-5d10-47c4-af6d-03b81942ebd3" />
                    <RowActions CGID="87bab90c-e83c-4ff1-986f-7b53d62a5998" />
                  </Rule>
                </Rules>
                <Conditions CGID="26b81f5b-3518-4c58-a521-94b58c97d4fd">
                  <Condition CGID="bdcbe8ff-3b52-45bf-b5b5-0a870b0d959d">
                    <Supplier>
                      <SourceValue>FlagField1</SourceValue>
                    </Supplier>
                    <FormatParams CGID="17b50e11-5ad2-4caa-a834-8f035add4e8d" />
                  </Condition>
                </Conditions>
                <Assignments CGID="7a875b47-a763-4e31-a19f-9c745a63d7ba" />
                <OrderByNodes CGID="24708876-175f-4a5f-89c9-f2cfe46393b4" />
                <GroupByNodes CGID="accccd1b-a4b9-4046-ba88-f39bcc874e50">
                  <GroupAtMostEntries CGID="e617cd07-e6d6-4f11-805d-59120f0e4aef">
                    <Supplier>
                      <ConstantValue>0</ConstantValue>
                    </Supplier>
                  </GroupAtMostEntries>
                </GroupByNodes>
                <MultiplyByNodes CGID="5dee0c3f-d7f4-4e73-8dac-192a6c664bca" />
                <RowActions CGID="127fc0e5-8612-443a-bc4b-81a75aaa11b0" />
              </RootRule>
              <MapExceptions CGID="6e73434f-aac2-4ded-9aa6-5ab995abcfe6" />
              <LoginCredentials CGID="ae9a6b10-b945-489a-914d-e791c04f578d" />
            </Profile>
          </InternalProfileActionNode>
        </BRElemNode>
      </Elems>
      <Conditions CGID="8fc092d8-0cd6-4559-b382-b716f4b81122">
        <Condition CGID="68f6f847-70d5-469e-a8c8-ec0771f2dec2">
          <Supplier CGID="569d00ad-a3b5-4b5e-b86e-5e87ac921046">
            <Param CGID="bece85b7-4360-4f33-9e5e-5d1f1058b367" ParamName="$TaskTypeCode">
              <Supplier>
                <SourceValue Path="FK_ESTMTask_ESTMTaskType">Code</SourceValue>
              </Supplier>
            </Param>
            <ExpressionValue>$TaskTypeCode.ToString() = "TAMCH"</ExpressionValue>
          </Supplier>
          <FormatParams CGID="123e28d5-7f73-4cf1-b10e-023ee82aa7a0" />
        </Condition>
      </Conditions>
      <ValidityConditions CGID="afda4125-b270-45ec-a39b-259e301dd6c1" />
      <ExecuteMessageConditions CGID="2f04c371-22ee-4f48-aefe-6be27e55cde4" />
    </CustomRule>
  </custom_rules>
  <Translations>
    <ESCaptionsDS>
  <Captions>
    <ID>487fcfe8-6713-4b44-ade4-52135a4b1b14</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αντιστοιχίσεις πελατών</Caption>
  </Captions>
  <Captions>
    <ID>d4e7ca55-897a-443b-8bf2-bd65a48ba167</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αντιστοιχίσεις πελατών</Caption>
  </Captions>
  <Captions>
    <ID>945caa64-6d09-444e-ab07-420b63602283</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Μεταφορά πεδίων επιλεγμένης γραμμής στο header</Caption>
  </Captions>
  <Captions>
    <ID>b934df83-c7f7-4a94-bc2c-7ccc5e8c6249</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Μεταφορά πεδίων επιλεγμένης γραμμής στο header</Caption>
  </Captions>
  <Captions>
    <ID>85f7acfc-daa0-4192-a1cc-393fd9896463</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>e617cd07-e6d6-4f11-805d-59120f0e4aef</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>8fc092d8-0cd6-4559-b382-b716f4b81122</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αντιστοιχίσεις πελατών</Caption>
  </Captions>
  <Captions>
    <ID>a9ccf6f7-434f-4df9-ad94-078f87dbd869</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Συμπλήρωση Περιγραφής Εργασίας</Caption>
  </Captions>
  <Captions>
    <ID>f3d95a95-c5e8-4df9-a02c-5db7e7011c23</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Συμπλήρωση Περιγραφής Εργασίας</Caption>
  </Captions>
  <Captions>
    <ID>2bd101bb-8966-4279-9f4d-da67943757c7</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Συμπλήρωση Περιγραφής Εργασίας</Caption>
  </Captions>
  <Captions>
    <ID>12d3a01c-d8f2-49a8-b0cc-7a25f6ef98b6</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Συμπλήρωση Περιγραφής Εργασίας</Caption>
  </Captions>
  <Captions>
    <ID>0f7bdcba-6bf9-4ccd-a216-ae474efa7faf</ID>
    <Suffix>Message</Suffix>
    <LangID>el</LangID>
    <Caption>Παρακαλώ συμπληρώστε Περιγραφή.</Caption>
  </Captions>
  <Captions>
    <ID>a056f182-0738-4d25-ba26-d7f283535cdf</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Συμπλήρωση Περιγραφής Εργασίας</Caption>
  </Captions>
  <Captions>
    <ID>d4568303-edf6-44c2-98c5-c0237063da91</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης Booked σε Μάθημα &amp; Ομαδική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>a401a9d5-96cf-4cfa-a910-4d53b46f6813</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης Booked σε Μάθημα &amp; Ομαδική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>9a8e0896-745f-4057-83fa-70d012420996</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε εργασίες Κοινωτικού κέντρου</Caption>
  </Captions>
  <Captions>
    <ID>4bf4040e-4ce2-40ff-86d7-c3afd8d75f2e</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε εργασίες Κοινωτικού κέντρου</Caption>
  </Captions>
  <Captions>
    <ID>4f1b09bc-1b93-4d02-80d6-6b7b2aab0504</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>b4c2e454-4340-4458-982b-49920197b23b</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης Booked σε Μάθημα &amp; Ομαδική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>a1833bf8-3787-4210-a42f-0c5a0a848942</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε Ατομική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>a2f31689-8104-4310-ad56-21a1819cfc80</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε Ατομική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>afaa19ef-4516-4867-b2f7-422793c9e289</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε Ατομική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>4c17d127-85f3-4289-80aa-601b801c7d1b</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε Ατομική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>021918fd-46d7-4d19-96b8-76cc4267b154</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>8b35ff40-4beb-48ff-bfd1-4fe30986a401</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε Ατομική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>b8b1f963-ab99-46cf-979d-9cc0698ba855</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος συμπλήρωσης θέσεων μαθημάτων</Caption>
  </Captions>
  <Captions>
    <ID>227f3b39-6491-4a63-9cb1-b6b2f19b2bb3</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος συμπλήρωσης θέσεων μαθημάτων</Caption>
  </Captions>
  <Captions>
    <ID>a8e6a75f-4200-4dd3-b684-e86e6c12122a</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος συμπλήρωσης θέσεων μαθημάτων</Caption>
  </Captions>
  <Captions>
    <ID>912694ef-1993-410c-88cc-7ab618bb4930</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος συμπλήρωσης θέσεων μαθημάτων</Caption>
  </Captions>
  <Captions>
    <ID>808c1cbb-15a0-4a05-a599-8d833e3c6a1b</ID>
    <Suffix>Message</Suffix>
    <LangID>el</LangID>
    <Caption>Προσοχή! Έχει συμπληρωθεί ο αριθμός συμμετεχόντων του μαθήματος $Description. Επιθυμείτε να συνεχίσετε;</Caption>
  </Captions>
  <Captions>
    <ID>daa31674-49bc-43d7-8648-8651ee77d985</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος συμπλήρωσης θέσεων μαθημάτων</Caption>
  </Captions>
  <Captions>
    <ID>f1619dd2-01e9-4ee6-b318-c96c85debe48</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης Open σε Μάθημα &amp; Ομαδική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>24edb249-a3f9-4a0d-89d6-6d6f2a76053f</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης Open σε Μάθημα &amp; Ομαδική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>c4c5b1f2-4a25-4455-97a1-95a637787815</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε εργασίες Κοινοτικού κέντρου</Caption>
  </Captions>
  <Captions>
    <ID>5eb50cee-b3dd-402f-bbc2-ee17f9430437</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης σε εργασίες Κοινοτικού κέντρου</Caption>
  </Captions>
  <Captions>
    <ID>e4358c5c-8ce5-44d8-8f0b-69a8d74f0a32</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>b2cf5232-d6b5-4848-8f33-0653c44d2deb</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Ενημέρωση Κατάστασης Open σε Μάθημα &amp; Ομαδική Συμβουλευτική</Caption>
  </Captions>
  <Captions>
    <ID>92c259a6-9584-4c1b-b02f-d5bb605c7c64</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αλλαγή ορίου συμμετοχων</Caption>
  </Captions>
  <Captions>
    <ID>5ef78f82-e83f-45f1-a20a-690e43cf10c4</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αλλαγή ορίου συμμετοχων</Caption>
  </Captions>
  <Captions>
    <ID>71c5e791-d82d-47b6-84fb-e0c8287cf30a</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αλλαγή ορίου συμμετοχων (sql)</Caption>
  </Captions>
  <Captions>
    <ID>7739d7dd-ec67-4ac8-b675-87a4a7ad2762</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αλλαγή ορίου συμμετοχων (sql)</Caption>
  </Captions>
  <Captions>
    <ID>3838713c-191a-4813-8966-d6c69457a4a8</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αλλαγή ορίου συμμετοχων</Caption>
  </Captions>
  <Captions>
    <ID>4f1a744d-9aeb-43bc-ad87-e3588dbfeb13</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Σύμπλήρωση έναρξης εθελοντισμού</Caption>
  </Captions>
  <Captions>
    <ID>22e399f4-819a-4633-b5c5-79264f0cee02</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Σύμπλήρωση έναρξης εθελοντισμού</Caption>
  </Captions>
  <Captions>
    <ID>421e3bc8-f179-46ff-9f5f-4c88d58643c4</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>8be0802c-937f-4695-90bd-1c381e2bbf2a</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος σε καταχώρηση συμβουλευτικής εργασίας</Caption>
  </Captions>
  <Captions>
    <ID>c95679f7-8eca-4b15-9279-ebd3b054ac02</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Έλεγχος καταχώρησης συμβουλευτικής την ίδια ώρα στον ίδιο συνεργάτη</Caption>
  </Captions>
  <Captions>
    <ID>52ea7888-dc44-41ca-95cc-2b5140e65fbc</ID>
    <Suffix>Message</Suffix>
    <LangID>el</LangID>
    <Caption>Έχετε ήδη καταχωρήσει συμβουλευτική συνάντηση την συγκεκριμένη ώρα με τον συγκεκρικριμένο συνεργάτη. Επιθυμείτε να συνεχίσετε;</Caption>
  </Captions>
  <Captions>
    <ID>27756520-75f8-4b81-a74b-93c37c5fe009</ID>
    <Suffix>Message</Suffix>
    <LangID>el</LangID>
    <Caption>Έχετε ήδη καταχωρήσει συμβουλευτική συνάντηση την συγκεκριμένη ώρα με τον συγκεκρικριμένο επωφελούμενο. Επιθυμείτε να συνεχίσετε;</Caption>
  </Captions>
  <Captions>
    <ID>1da1ba77-0af4-4f93-95b5-ee2344ed76fa</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Reporting</Caption>
  </Captions>
  <Captions>
    <ID>808ee55d-5b95-4a57-a16b-0e3f391e0383</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Reporting</Caption>
  </Captions>
  <Captions>
    <ID>23118608-a057-49bd-9b72-f7d62ee58ba6</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>06717ca5-18c7-43e0-8677-ec2e27d079dd</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Πόρος ανάθεσης προγραμμάτων</Caption>
  </Captions>
  <Captions>
    <ID>099e0a5b-5592-4eed-a451-304277bc9edb</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Assign to</Caption>
  </Captions>
  <Captions>
    <ID>cafc9ad9-4668-487a-935d-5a16279cbd10</ID>
    <Suffix>Message</Suffix>
    <LangID>el</LangID>
    <Caption>Login User Has No Value for Location</Caption>
  </Captions>
  <Captions>
    <ID>2834645a-254b-4c5d-9eed-8bad25468fe8</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
  <Captions>
    <ID>fb515a7c-ce4b-42fa-9815-c08e9a008604</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Αλλαγή Πόρου ανάθεσης προγραμμάτων</Caption>
  </Captions>
  <Captions>
    <ID>85f36690-c67a-4139-a394-856779301228</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Change Assign to</Caption>
  </Captions>
  <Captions>
    <ID>24cbc4d2-9b79-4fa2-a4a3-e94c47f92459</ID>
    <Suffix>Message</Suffix>
    <LangID>el</LangID>
    <Caption>Login User Has No Value for Location</Caption>
  </Captions>
  <Captions>
    <ID>957891fc-c133-48b1-87ad-92c56213bc3d</ID>
    <Suffix>Title</Suffix>
    <LangID>el</LangID>
    <Caption>Maximum Entries</Caption>
  </Captions>
</ESCaptionsDS>
  </Translations>
</BRDatasetNode>

What I'm trying to do is to find a way to search in all elements below /BRDatasetNode/custom_rules/CustomRule/Elems/BRElemNode that have patricular value on specific attribute and when these are filtered to get their 2 top parents ( CustomRule and BRElementNode) ...The hard thing is that then i need to join the results with the last element of the xml that contains the (Translation) of every element ... The element has most of the elements captions(Tranlasion) and the join is on CustomRule.CGID = Captions.ID ]

I have use BASEX and wrote the query in XQUERY that works like a charm but then i realized that it was not possible to use the exact XQUERY in my VB.NET program..

The XQUERY is

for $x in /BRDatasetNode/custom_rules/CustomRule/Elems/BRElemNode,
$c in /BRDatasetNode/Translations/ESCaptionsDS/Captions,
$zz in /BRDatasetNode/Translations/ESCaptionsDS/Captions
let $z:=$x/../..
where $x//lower-case(@Column)="faddimension1code"
and $x/@CGID=$c/ID
and $z/@CGID=$zz/ID
return (:$z/@CGID ||' '||:) $zz/Caption ||'--> '|| (:$x/@CGID ||' '||:)$c/Caption 

Then i discovered LINQ TO XML but i'm really Stuck !

I tried the following but the Merged Collection seems to by empty ...

Dim filename As String = "D:\\THK Files\\1.009 VB.NET\\Sample XMLs\\MyFile.xml"
Dim xDoc As XDocument = XDocument.Load(filename)
Dim list1 As XElement = xDoc.Element("BRDatasetNode").Element("custom_rules")
Dim list2 As XElement = xDoc.Element("BRDatasetNode").Element("Translations").Element("ESCaptionsDS")

Dim Merged As XElement = New XElement("Root",
                                          From c In list1.Elements
                                          Join o In list2.Elements
                                              On CStr(c.Attribute("CGID")) Equals CStr(o.Element("ID"))
                                          Select c.Element("custom_rules"), o.Element("Caption"))

Solution

  • I couldn't see how your condition $x//lower-case(@Column)="faddimension1code" is matched in the document sample you have shown, without that condition the LINQ to XML in VB.NET I think is

        Dim query = From x In xmlDoc.<BRDatasetNode>.<custom_rules>.<CustomRule>.<Elems>.<BRElemNode>,
                         c In xmlDoc.<BRDatasetNode>.<Translations>.<ESCaptionsDS>.<Captions>,
                         zz In xmlDoc.<BRDatasetNode>.<Translations>.<ESCaptionsDS>.<Captions>
                    Let z = x.Parent.Parent
                    Where x.@CGID = c.<ID>.Value And z.@CGID = zz.<ID>.Value
                    Select zz.<Caption>.Value + "-->" + c.<Caption>.Value
    

    so the whole sample

        Dim xmlDoc As XDocument = XDocument.Load("MyFile.xml")
    
        Dim query = From x In xmlDoc.<BRDatasetNode>.<custom_rules>.<CustomRule>.<Elems>.<BRElemNode>,
                         c In xmlDoc.<BRDatasetNode>.<Translations>.<ESCaptionsDS>.<Captions>,
                         zz In xmlDoc.<BRDatasetNode>.<Translations>.<ESCaptionsDS>.<Captions>
                    Let z = x.Parent.Parent
                    Where x.@CGID = c.<ID>.Value And z.@CGID = zz.<ID>.Value
                    Select zz.<Caption>.Value + "-->" + c.<Caption>.Value
    
        Console.OutputEncoding = Encoding.UTF8
    
        Console.WriteLine(String.Join(", ", query))
    

    and gives Αντιστοιχίσεις πελατών-->Μεταφορά πεδίων επιλεγμένης γραμμής στο header