std::string CPush::DropdownOptionsValue(const unsigned long long DeviceRowIdxIn, const int pos) { std::string wording = "???"; int getpos = pos-1; // 0 pos is always nvalue/status, 1 and higher goes to svalues std::vector<std::vector<std::string> > result; result=m_sql.safe_query("SELECT Type, SubType FROM DeviceStatus WHERE (ID== %llu)", DeviceRowIdxIn); if (result.size()>0) { int dType=atoi(result[0][0].c_str()); int dSubType=atoi(result[0][1].c_str()); std::string sOptions = RFX_Type_SubType_Values(dType,dSubType); std::vector<std::string> tmpV; StringSplit(sOptions, ",", tmpV); if (tmpV.size() > 1) { if ( (int) tmpV.size() >= pos && getpos >= 0) { wording = tmpV[getpos]; } } else if (tmpV.size() == 1) { wording = sOptions; } } return wording; }
std::vector<std::string> CDataPush::DropdownOptions(const unsigned long long DeviceRowIdxIn) { std::vector<std::string> dropdownOptions; std::vector<std::vector<std::string> > result; char szTmp[300]; sprintf(szTmp, "SELECT Type, SubType FROM DeviceStatus WHERE (ID== %llu)", DeviceRowIdxIn); result=m_sql.query(szTmp); if (result.size()>0) { int dType=atoi(result[0][0].c_str()); int dSubType=atoi(result[0][1].c_str()); std::string sOptions = RFX_Type_SubType_Values(dType,dSubType); std::vector<std::string> tmpV; StringSplit(sOptions, ",", tmpV); for (int i = 0; i < (int) tmpV.size(); ++i) { dropdownOptions.push_back(tmpV[i]); } } else { dropdownOptions.push_back("Not implemented"); } return dropdownOptions; }