Announcement

Collapse
No announcement yet.

Like in Fielddefinitions of the SelectManager

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Like in Fielddefinitions of the SelectManager

    How do i get a SQLString from a Selectmanager that looks like that:
    Code:
    SELECT `name` like '%GmbH%' as isGmbH FROM `account`;

  • #2
    I have solved it,by adding the following to getSelect in CRM/application/Espo/ORM/DB/Query/Base.php
    Code:
     if (stripos($attribute[0], 'VALUE:') === 0) {
                        $part = substr($attribute[0], 6);
                        if ($part !== false) {
                            $part = $this->quote($part);
                        } else {
                            $part = $this->quote('');
                        }
                    }
    [COLOR=#006400][B] else if(stripos($attribute[0], 'RAW:') === 0)
                    {
                        $part = substr($attribute[0], 4);
                    }[/B][/COLOR]
                    else {
                        if (!array_key_exists($attribute[0], $entity->fields)) {
                            $part = $this->convertComplexExpression($entity, $attribute[0], $distinct);
                        } else {
                            $fieldDefs = $entity->fields[$attribute[0]];
                            if (!empty($fieldDefs['select'])) {
                                $part = $fieldDefs['select'];
                            } else {
                                if (!empty($fieldDefs['notStorable']) || !empty($fieldDefs['noSelect'])) {
                                    continue;
                                }
                                $part = $this->getFieldPath($entity, $attribute[0]);
                            }
                        }
                    }
    [COLOR=#424242][SIZE=12px][/SIZE][/COLOR]

    Comment


    • telecastg
      telecastg commented
      Editing a comment
      Thanks for posting the solution Andorxor this is how we can all benefit from reading/participating in this forum.
Working...
X