Background Color:
 
Background Pattern:
Reset
Search

Forum

Please Log In

We want you to contribute! 

This forum is a moderated environment. 
We try to keep it neat and tidy. In order to access the forum content we would like you to either or register.

HomeHomeScryberScryberDevelopment Que...Development Que...IF statement can only use attributes?IF statement can only use attributes?
Previous
 
Next
New Post
5/11/2017 6:13 PM
 

Can we only use attributes in if statements?

my serialized object only has x:paths and would really like to be able to use just the xpath value:

 <ActionDetailsItem>

    <Id>16</Id>

    <DateAction>2017-04-26T00:00:00</DateAction>

    <EvenementId>8</EvenementId>

    <Lieu>Culée C2</Lieu>

    <Concerne>M-Ouv -Oeuv / Entr. (dont BA Minage) / AMO</Concerne>

    <DateButoir>2017-05-11T00:00:00</DateButoir>

    <SuiviId>0</SuiviId>

    <AffectationId>56</AffectationId>

    <Archived>false</Archived>

    <DateSuivi>0001-01-01T00:00:00</DateSuivi>

    <Evenement>

      <Id>8</Id>

      <Nom>Minage</Nom>

    </Evenement>

    <SuiviType>

      <Id>0</Id>

      <Nom>Non Effectuée</Nom>

    </SuiviType>

    <IsSuiviEmpty>true</IsSuiviEmpty>

    <IsDone>false</IsDone>

    <ActionValidationState>AlmostInvalid</ActionValidationState>

    <SortByDateButoir>2017-05-11T00:00:00</SortByDateButoir>

  </ActionDetailsItem>  

 

 

Like on   <IsDone>false</IsDone> for example

Maybe my XML knowledge is too lacking to understand why :P

 

 
New Post
5/11/2017 11:56 PM
 

There is no restriction on what type of node can be used in the xpath expression, only that the result should be a boolean value.

Hope the below helps.

<?xml version="1.0" encoding="utf-8" ?>

<pdf:Document xmlns:pdf="Scryber.Components, Scryber.Components, Version=0.9.0.0, Culture=neutral, PublicKeyToken=872cbeb81db952fe"

              xmlns:data="Scryber.Data, Scryber.Components, Version=0.9.0.0, Culture=neutral, PublicKeyToken=872cbeb81db952fe"

              xmlns:style="Scryber.Styles, Scryber.Styles, Version=0.9.0.0, Culture=neutral, PublicKeyToken=872cbeb81db952fe"

              auto-bind="true" >

  <Render-Options compression-type="FlateDecode"></Render-Options>

  <Viewer page-display="Thumbnails" page-layout="SinglePage"/>

  <Styles>

 

    <style:Styles-Ref source="BaseStyles.psfx" />

 

  </Styles>

  <Items>

    <pdf:Xml-Item key="One" >

      <ActionDetailsItem>

        <Id>16</Id>

        <DateAction>2017-04-26T00:00:00</DateAction>

        <EvenementId>8</EvenementId>

        <Lieu>Culée C2</Lieu>

        <Concerne>M-Ouv -Oeuv / Entr. (dont BA Minage) / AMO</Concerne>

        <DateButoir>2017-05-11T00:00:00</DateButoir>

        <SuiviId>0</SuiviId>

        <AffectationId>56</AffectationId>

        <Archived>false</Archived>

        <DateSuivi>0001-01-01T00:00:00</DateSuivi>

        <Evenement>

          <Id>8</Id>

          <Nom>Minage</Nom>

        </Evenement>

        <SuiviType>

          <Id>0</Id>

          <Nom>Non Effectuée</Nom>

        </SuiviType>

        <IsSuiviEmpty>true</IsSuiviEmpty>

        <IsDone>false</IsDone>

        <ActionValidationState>AlmostInvalid</ActionValidationState>

        <SortByDateButoir>2017-05-11T00:00:00</SortByDateButoir>

      </ActionDetailsItem>

    </pdf:Xml-Item>

  </Items>

  <Pages>

 

    <pdf:Page >

      <Content>

 

        <data:XMLDataSource id="ItemOne" xml-node-data="{item:One}" />

        

        <data:ForEach datasource-id="ItemOne" select="/ActionDetailsItem" >

          <Template>

            <data:Choose>

              <data:When test="IsDone = 'false'" >

                <Template>

                  This item is NOT done

                </Template>

              </data:When>

              <data:Otherwise>

                <Template>

                  This is actually completed.

                </Template>

              </data:Otherwise>

            </data:Choose>

          </Template>

        </data:ForEach>

      </Content>

    </pdf:Page>

  </Pages>

</pdf:Document>


 
New Post
5/12/2017 9:29 AM
 

Thank you for example! That is what I am using.. It is not evaluating IsDone properly in my case it always goes straight to "otherwise". Mind you I am using a list of items (compared to you're example) but still that should not make a difference since you foreach over the single item..

Invoking the template:

https://pastebin.com/DmT4Tuey

Template used:

https://pastebin.com/2Z8UyA7C

 

Only difference I see is that you are using " xml-node-data" for the xml binding and i am using xpath-data.. (for some reason it throws an exception when i use xml-node-data"..

Thanks for all your valuable input.


Tim


 
New Post
5/12/2017 10:10 AM
 

It seems its not evaluating the string "false". If I replace with numbers all goes well.

Thank you for the time you spent helping me. Will be contacting you for a licence in the next couple of weeks. 

Tim

 

Edit: I got around the issue by adding a property of type int PDFIsDone to my object that is set in the setter of IsDone : PDFIsDone = value ? 1 : 0; so their is no real hurry.

 
Previous
 
Next
HomeHomeScryberScryberDevelopment Que...Development Que...IF statement can only use attributes?IF statement can only use attributes?