Doubt about table

Jaseel s

Read only
Read only
Регистрация
23.12.2016
Сообщения
44
Благодарностей
1
Баллы
8
Hello,
I have 2 columns in my table which column 1 contains 'Name of countries' and column 2 contains 'Capital cities of corresponding coundries' .

I need to get the coundry name when we call its capital.
I also have list of coundries and list of capitals in the same order.

Please help to solve this
 

PHaRTnONu

Client
Регистрация
01.10.2016
Сообщения
340
Благодарностей
48
Баллы
28
Код:
// take text for search from a variable (just the name of the varible not the whole {-variable. you want whats after the . 
var textContains = project.Variables["///NAME-OF-VARIBEL-HERE///"].Value;
// get table for search replace whats in the pathereses with the naem of the table in PM
var sourceTable = project.Tables["///TABLE-NAME-HERE///"];
// search in each row
lock(SyncObjects.TableSyncer)
{
  for(int i=0; i < sourceTable.RowCount; i++)
  {
  // read a row (array of cells)
  var cells = sourceTable.GetRow(i).ToArray();
  // loop through all cells
  for (int j=0; j < cells.Length; j++)
  {
  // check if cell contains specified text, if there are matches return "yes"
  if (cells[j].Contains(textContains))
  return i;
  }
  }
}
// if nothing found return "no"
return "no";
result is the row number.
second block after is
table processing
in row you put something like {-Variable.LookupResult-}
or what ever you made the result for the c# code
and then the corresponding column you want
 
  • Спасибо
Реакции: Jaseel s

Jaseel s

Read only
Read only
Регистрация
23.12.2016
Сообщения
44
Благодарностей
1
Баллы
8
Works like a charm :D:D:D
 
  • Спасибо
Реакции: PHaRTnONu

PHaRTnONu

Client
Регистрация
01.10.2016
Сообщения
340
Благодарностей
48
Баллы
28

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)