Announcement

Collapse
No announcement yet.

Help with the formula.

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

  • Help with the formula.

    Requesting data from the API. As a result, I want to receive such data and drag it into the database (see the code below). The problem is that when I receive data, the service sometimes sends emptiness and emptiness is written to the database, and I need to be safe from this, what needs to be written in the code so that if the data comes 0 or emptiness is not written to the database? Thank you in advance.

    $area = json\retrieve($_lastHttpResponseBody, 'EGRN.object.AREA');
    entity\setAttribute('EGRN.object.AREA', $area),

    $area = string\replace($area, ' (квадратный метр)', '');
    $area = string\replace($area, ' кв.м', '');
    $area = string\replace($area, ' кв. м.', '');

    area = $area;

    $cadastrCost = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Кадастровая стоимость');
    entity\setAttribute('EGRN.details.Кадастровая стоимость', $_lastHttpResponseBody);

    cadastrCost = $cadastrCost;

    $type = json\retrieve($_lastHttpResponseBody, 'EGRN.object.TYPE');
    entity\setAttribute('EGRN.object.TYPE', $_lastHttpResponseBody);

    type = $type;

    $dateCostEntry = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Дата внесения стоимости');
    entity\setAttribute('EGRN.details.Дата внесения стоимости', $_lastHttpResponseBody);

    dateCostEntry = $dateCostEntry;

    $dateCostCreate = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Дата определения стоимости');
    entity\setAttribute('EGRN.details.Дата определения стоимости', $_lastHttpResponseBody);

    dateCostCreate = $dateCostCreate;

    $yearEnd = json\retrieve($_lastHttpResponseBody, 'EGRN.details.(ОКС) Завершение строительства');
    entity\setAttribute('EGRN.details.(ОКС) Завершение строительства', $_lastHttpResponseBody);

    yearEnd = $yearEnd;

    $cadastrDate = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Дата постановки на кадастровый учет');
    entity\setAttribute('EGRN.details.Дата постановки на кадастровый учет', $_lastHttpResponseBody);

    cadastrDate = $cadastrDate;

    $xcoordnate = json\retrieve($_lastHttpResponseBody, '0.coordinates');
    entity\setAttribute('0.coordinates', $_lastHttpResponseBody);

    xcoordnate = $xcoordnate;

    $ycoordnate = json\retrieve($_lastHttpResponseBody, '1.coordinates');
    entity\setAttribute('1.coordinates', $_lastHttpResponseBody);

    ycoordnate = $ycoordnate;

    $floor = json\retrieve($_lastHttpResponseBody, 'EGRN.details.(ОКС) Этажность');
    entity\setAttribute('EGRN.details.(ОКС) Этажность', $_lastHttpResponseBody);

    floor = $floor;

    $material = json\retrieve($_lastHttpResponseBody, 'EGRN.details.(ОКС) Материал стен');
    entity\setAttribute('EGRN.details.(ОКС) Материал стен', $_lastHttpResponseBody);

    material = $material;

    $actualDate = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Дата актуальности информации в ЕГРП');
    entity\setAttribute('EGRN.details.Дата актуальности информации в ЕГРП', $_lastHttpResponseBody);

    actualDate = $actualDate;

    $colPrava = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Количество правообладателей');
    entity\setAttribute('EGRN.details.Количество правообладателей', $_lastHttpResponseBody);

    colPrava = $colPrava;

    $createObject = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Способ образования объекта');
    entity\setAttribute('EGRN.details.Способ образования объекта', $_lastHttpResponseBody),

    createObject = $createObject;

    $outSideObject = json\retrieve($_lastHttpResponseBody, 'EGRN.details.Кадастровый номер здания или сооружения, в котором располагается помещение');
    entity\setAttribute('EGRN.details.Кадастровый номер здания или сооружения, в котором располагается помещение', $_lastHttpResponseBody),

    outSideObject = $outSideObject;

    $firstPropertyNum = json\retrieve($_lastHttpResponseBody, 'EGRN.rights.0.number');
    entity\setAttribute('EGRN.rights.0.number', $_lastHttpResponseBody);

    firstPropertyNum = $firstPropertyNum;

    $datePropertyFirst = json\retrieve($_lastHttpResponseBody, 'EGRN.rights.0.date');
    entity\setAttribute('EGRN.rights.0.date', $_lastHttpResponseBody);

    datePropertyFirst = $datePropertyFirst;

    $typePropertyFirst = json\retrieve($_lastHttpResponseBody, 'EGRN.rights.0.type');
    entity\setAttribute('EGRN.rights.1.type', $_lastHttpResponseBody);

    typePropertyFirst = $typePropertyFirst;

    $secondPropertyNum = json\retrieve($_lastHttpResponseBody, 'EGRN.rights.1.number');
    entity\setAttribute('EGRN.rights.1.number', $_lastHttpResponseBody);

    secondPropertyNum = $secondPropertyNum;


    $secondPropertyDate = json\retrieve($_lastHttpResponseBody, 'EGRN.rights.1.date');
    entity\setAttribute('EGRN.rights.1.date', $_lastHttpResponseBody);

    secondPropertyDate = $secondPropertyDate;

    $secondPropertyType = json\retrieve($_lastHttpResponseBody, 'EGRN.rights.1.type');
    entity\setAttribute('EGRN.rights.1.type', $_lastHttpResponseBody);

    secondPropertyType = $secondPropertyType;

  • #2
    Hi you can try to condition it to not accept null, see example below:

    Code:
    $area = json\retrieve($_lastHttpResponseBody, 'EGRN.object.AREA');
    
    ifThen($area != null,
    entity\setAttribute('EGRN.object.AREA', $area)
    );
    You can just condition anything like this so this way the system will only save data into database if it is not null (not empty).

    Hope this helps

    Cheers
    Rabii
    Web Dev

    Comment

    Working...
    X