Skip to main content
deleted 97 characters in body; edited title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

drupal 7 calculated Calculated field returns undefined index

Ok, struggling now after two hours - and I still cant get it.

I'm trying to average all of the fivestar ratings I have for a node using a computed field. But i'm struggling to simply access the other fields using entity!

In the body of the node, this works fine: [code] $test1 = $node->field_ae_stimclasswrk[und][0]['average']; [/code]

$test1 = $node->field_ae_stimclasswrk[und][0]['average'];

but inIn the computed field area, this doesn't work:

[code] $entity_field[0]['value'] = $entity->field_ae_stimclasswrk[$entity->language][und][0]['average']; [/code]

$entity_field[0]['value'] = $entity->field_ae_stimclasswrk[$entity->language][und][0]['average'];

Instead, when I save the node, I get this index error:

Notice: Undefined index: und in eval() (line 2 of...

Notice: Undefined index: und in eval() (line 2 of...

It must be something syntax, but i'mI'm completely out of ideas.

hereHere is the field info:

[code] [field_ae_stimclasswrk] => Array ( [und] => Array ( [0] => Array ( [user] => 80 [average] => 80 [count] => 1 )

            )

    )

    [field_ae_stimclasswrk] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [user] => 80
                            [average] => 80
                            [count] => 1
                        )

                )

        )

[/code]

drupal 7 calculated field returns undefined index

Ok, struggling now after two hours - and I still cant get it.

I'm trying to average all of the fivestar ratings I have for a node using a computed field. But i'm struggling to simply access the other fields using entity!

In the body of the node, this works fine: [code] $test1 = $node->field_ae_stimclasswrk[und][0]['average']; [/code]

but in the computed field area, this doesn't work:

[code] $entity_field[0]['value'] = $entity->field_ae_stimclasswrk[$entity->language][und][0]['average']; [/code]

Instead, when I save the node, I get this index error:

Notice: Undefined index: und in eval() (line 2 of...

It must be something syntax, but i'm completely out of ideas.

here is the field info:

[code] [field_ae_stimclasswrk] => Array ( [und] => Array ( [0] => Array ( [user] => 80 [average] => 80 [count] => 1 )

            )

    )

[/code]

Calculated field returns undefined index

I'm trying to average all of the fivestar ratings I have for a node using a computed field. But i'm struggling to simply access the other fields using entity!

In the body of the node, this works fine:

$test1 = $node->field_ae_stimclasswrk[und][0]['average'];

In the computed field area, this doesn't work:

$entity_field[0]['value'] = $entity->field_ae_stimclasswrk[$entity->language][und][0]['average'];

Instead, when I save the node, I get this index error:

Notice: Undefined index: und in eval() (line 2 of...

It must be something syntax, but I'm completely out of ideas.

Here is the field info:


    [field_ae_stimclasswrk] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [user] => 80
                            [average] => 80
                            [count] => 1
                        )

                )

        )
Source Link

drupal 7 calculated field returns undefined index

Ok, struggling now after two hours - and I still cant get it.

I'm trying to average all of the fivestar ratings I have for a node using a computed field. But i'm struggling to simply access the other fields using entity!

In the body of the node, this works fine: [code] $test1 = $node->field_ae_stimclasswrk[und][0]['average']; [/code]

but in the computed field area, this doesn't work:

[code] $entity_field[0]['value'] = $entity->field_ae_stimclasswrk[$entity->language][und][0]['average']; [/code]

Instead, when I save the node, I get this index error:

Notice: Undefined index: und in eval() (line 2 of...

It must be something syntax, but i'm completely out of ideas.

here is the field info:

[code] [field_ae_stimclasswrk] => Array ( [und] => Array ( [0] => Array ( [user] => 80 [average] => 80 [count] => 1 )

            )

    )

[/code]