getValue method

dynamic getValue(
  1. dynamic name,
  2. dynamic colId,
  3. dynamic id
)

Implementation

getValue(name, colId, id) {
  myLogAll('getValue');
  id = id ?? '';
  dynamic result = {gValue: '', gType: gOriginalValue};
  if (colId.toString().indexOf(')') > 0) {
    result[gValue] = getValueLabel(colId, gOriginalValue);
    return result;
  }

  var typeOwner = gForm;
  if (_tableList.isNotEmpty && _tableList[name] != null) {
    typeOwner = gTable;
    if (colId == gSearchZzy) {
      return {gValue: _tableList[name]![gSearch] ?? '', gType: gSearch};
    }

    //if is compute
    dynamic item = getTableCol(name, colId);
    if (isNull(item)) {
      return result;
    }
    if (!isNull(item[gCompute])) {
      var computeValue = item[gCompute];

      var valueCompute = getValueExpression(computeValue, name, id);
      Map acol = getTableCol(name, colId);
      result[gValue] = getValueGUI(valueCompute, acol);
      return result;
    }
  } else if (isNull(_formLists[name])) {
    //check zzydictionary
    if (isNull(_tableList)) {
      return result;
    }
    dynamic tabledata = _tableList[gZzydictionary];
    if (isNull(tabledata)) {
      return result;
    }
    if (isNull(tabledata[gData])) {
      return result;
    }

    List tabledataList = tabledata[gData];
    dynamic tabledataItem = _tableList[gZzydictionaryitem];
    if (isNull(tabledataItem)) {
      return result;
    }

    List tabledataListItem = tabledataItem[gData];
    if (isNull(tabledataListItem)) {
      return result;
    }
    for (var element in tabledataList) {
      var label = element[gLabel];
      if (label != name) {
        continue;
      }
      var parentid = element[gId];
      for (var elementItem in tabledataListItem) {
        if (elementItem[gParentid] != parentid || elementItem[gId] != id) {
          continue;
        }

        dynamic value = elementItem[colId];
        return {gValue: value, gType: gOriginalValue};
      }
    }
  }
  var value =
      getModifiedValueByType(name, colId, id, gDataModified, typeOwner);
  if (!isNull(value)) {
    return {gValue: value, gType: gDataModified};
  }
  value = getModifiedValueByType(
      name, colId, id, gDataModifiedInvalid, typeOwner);
  if (!isNull(value)) {
    return {gValue: value, gType: gDataModifiedInvalid};
  }
  return {gValue: getValueOriginal(name, colId, id), gType: gOriginalValue};
}