Project

General

Profile

Actions

Feature #58817

closed

Why does isPositive not handle values like 01010101110 like isGreaterThan does?

Added by Christian Stern over 10 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
-- undefined --
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2014-05-15
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.5
Tags:
Complexity:
Sprint Focus:
Needs Decision

Description

I was wondering if isPostive could also handle values like 000010000101010101. Or does it makes no sense at all?

I had to check, if any setting was made. Each setting is numeric value inside a LOAD_REGISTER. So I put them all together into one value: 0300040010100110700. My first attempent was to look, if it is a positive.

IsPositive was not working, as expected. So I had to remove all zeros first. But I found out that isGreaterThan works as I need right now.

Example

page >
page = PAGE

page.10 = COA
page.10 {
  1 = LOAD_REGISTER
  1 {
    testme = 0101010101
  }

  10 = TEXT
  10 {
    value = testing isPostive against 0101010101. Result:
    noTrimWrap = || |
  }

  20 = TEXT
  20 {
    value = isPositive

    if.isPositive.data = REGISTER:testme 
  }
}

page.20 = TEXT
page.20.value = <hr>

page.30 = COA
page.30 {
  1 = LOAD_REGISTER
  1 {
    testme.cObject = TEXT
    testme.cObject {
      value = 0101010101
      replacement {
        10 {
          search = 0
          replace = 
        }
      }
    }
  }

  10 = TEXT
  10 {
    value = testing isPostive against 0101010101. But removed all zeros before Result:
    noTrimWrap = || |
  }

  20 = TEXT
  20 {
    value = isPositive

    if.isPositive.data = REGISTER:testme 
  }
}

page.40 = TEXT
page.40.value = <hr>

page.50 = COA
page.50 {
  1 = LOAD_REGISTER
  1 {
    testme = 000000000000000010
  }

  10 = TEXT
  10 {
    value = testing isGreaterThan against 000000000000000010. Result:
    noTrimWrap = || |
  }

  20 = TEXT
  20 {
    value = isGreaterThan 

    if {
      value = 9
      isGreaterThan.data = REGISTER:testme 
    }
  }
}
Actions

Also available in: Atom PDF