Conditional format that recognizes > than or ≤

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
jrcervantest
Veteran Member
Posts: 32
Joined: 2020-06-22 00:00

Conditional format that recognizes > than or ≤

Post by jrcervantest » 2020-07-22 03:17

Respectfully request some assistance. For the following conditional format code, does anyone know what the replacement syntax would be for a value greater than (>) or less than or equal to (≤)?

V/r,
----------------------------------

<script>
$j(function(){
$j('.links-datecalc').each(function(){
var datecalc = $j(this).text();
if (datecalc == '9'){
$j(this).addClass('success');
}
if (datecalc == '7'){
$j(this).addClass('info');
}
if (datecalc == '-'){
$j(this).addClass('danger');
}
})
})
</script>

jrcervantest
Veteran Member
Posts: 32
Joined: 2020-06-22 00:00

Re: Conditional format that recognizes > than or ≤

Post by jrcervantest » 2020-07-24 20:11

FOUND ANSWER :!:

Get rid of the quote around the numerical value.

----SAMPLE SYNTAX----
<script>
$j(function(){
$j('.links-datecalc').each(function(){
var datecalc = $j(this).text();
if (datecalc > 9){
$j(this).addClass('success');
}
if (datecalc < 7){
$j(this).addClass('info');
}
if (datecalc <= -2){
$j(this).addClass('danger');
}
})
})
</script>

User avatar
fbrano
Veteran Member
Posts: 70
Joined: 2018-03-19 10:39
Location: Slovakia
Contact:

Re: Conditional format that recognizes > than or ≤

Post by fbrano » 2020-07-31 10:00

How to format condition for Null value? Neither of these conditions works:
var status = $j(this).text();
a) if(status == 'Null'){
b) if(status == Null){
c) if(status == ''){
ver 23.15 1484

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Conditional format that recognizes > than or ≤

Post by jsetzer » 2020-07-31 10:16

You can output current value of status-variable to console of your browser's development tools and check it:

Code: Select all

console.log(status);
Could be:
  • undefined

    Code: Select all

    if (status === undefined) { ... }
    
  • null

    Code: Select all

    if (status === null) { ... }
    
  • empty string

    Code: Select all

    if (status === '') { ... }
    
  • or any value or object
Regards,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
fbrano
Veteran Member
Posts: 70
Joined: 2018-03-19 10:39
Location: Slovakia
Contact:

Re: Conditional format that recognizes > than or ≤

Post by fbrano » 2020-07-31 12:19

console said undefined, but still no collour
ver 23.15 1484

Post Reply